As you found, Peak/Trough use the Zig-Zag function. The problem is the zig-zag function looks into the future and is not tradeable is real-time. You will get fabulous backtests though.
The reason zig-zag looks into the future is because it "waits" for the specified % change to happen. Let's say you set it to 5% zigzag. After the market has changed direction for at least 5% is GOES BACK and marks the low of that change. It could be yesterday, it could be two weeks ago. -- Terry -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ernie Newman Sent: Tuesday, August 15, 2006 16:17 To: [email protected] Subject: [amibroker] Peak and Tough Functions I don't understand how the Peak and Trough functions work? I would like to have a condition that if Peak 1 > Peak 2 then continue. Peak 1 would be the most recent hhv as a peak and peak 2 would be the peak before peak 1. To me a peak is defined as Ref(high,-2) < Ref(high,- 1) and Ref(high,-1) > high today. The below says that Peak needs a % change and something about Zig Zag function. I just want the latest peak to be greater than the peak before it. peak(ARRAY, change, n = 1) RETURNS ARRAY FUNCTION Gives the value of ARRAY n-th peak(s) ago. This uses the Zig Zag function (see Zig Zag) to determine the peaks. n =1 would return the value of the most recent peak. n =2 would return the value of the 2nd most recent peak. Caveat: this function is based on Zig-Zag indicator and may look into the future. EXAMPLE peak(close,5,1) THANKS Ernie Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
