Hello, You admit that you are complete novice, yet you make definitive statements like this:
>It simply loops from 0 to the bar and finds min and max. >Then, after a reversal happens, it assigns the last min or max to an array. >That's all. You simply see the trees but you don't see the forest. When you say "after a reversal happens" you don't realise that in order to know that reversal actually happens you must look into the future (i.e. you must look at bars that occur AFTER THE PEAK) and find out that the price moved in opposite direction and then you go back and mark that "peak" occured at "max" that you found earlier (so you modify past output based on future). Finding "that reversal happens" is where looking into the future occurs. Apparently, you are also not aware of the simple fact that the above *IS* actually zig-zag algorithm and that peak and trough functions are _products_ of zig-zag algorithm. Peak in WL is based on zig-zag algorithm. Go ask Wealth Lab support and they will tell you. Any indicator that does not look into the future must a) use only *past* data to calculate current bar output b) never update/adjust past output based on current bar data Peak/Trough/Zig fail at condition b) unless output is delayed as I explained earlier. I also suggest reading some articles for example this: http://store.traders.com/v212zitrinby.html Regarding trendline formula you were interested in - the point is that it used SelectedValue to draw single trendline. You can not simply remove SelectedValue from such formula because it relied on manual input (namely selecting given quote by the user and drawing trendline from such point). In order to remove SelectedValue you would need to come up first with conditions that say when to start and when to end the trendline because it is not always obvious. For ready-to-use solutions regarding pattern trading you may check this 3rd party site: http://www.patternexplorer.com/ that offers pattern formulas that work in automatic manner. Best regards, Tomasz Janeczko amibroker.com On 2010-04-26 20:37, jhnlmn wrote: > > Hi, > Thank you for the explanation. > > >> You still don't understand anything about zigzag algorithm. >> > Of course, not. As I said, I am a complete novice to AB. > I was using WL before and it does not have Zigzag at all. > You are not correct when you say that Peak/Trough in WL is based on Zigzag > or looks into the future. It never references any bar after the given one. > It simply loops from 0 to the bar and finds min and max. > Then, after a reversal happens, it assigns the last min or max to an array. > That's all. > > Earlier I posted a question about SelectedValue or LastValue, > but Mike warned me about the danger of Peak and TroughBar functions. > So, I looked at AB help and it says only: > "zig(ARRAY, change ) ... Calculates the minimum % change Zig Zag indicator. > Caveat: this function is based on Zig-Zag indicator and may look into the > future - this means that you can get unrealistic results when back testing > trading system using this indicator. This function is provided rather for > pattern and trend recognition formulas." > As you see, this does not explain anything. What does "minimum % change" > mean? When does it look into the future and how far? How unrealistic the > results would be? > How to delay the result to undo the effect of looking into the future? The > help is not helpful. > So, until you posted this script in your message, I had no way to understand > Zigzag. > Now I understood. Thank you. > > However, my original question was not about Zigzag (it was Mike, who raised > warning about them). > The question was about the proper way of rewriting scripts, which use > SelectedValue or LastValue, > to make them appropriate for backtesting and indicator drawing. > I wonder whether someone could take a look and comment on my attempt to fix > the script: > http://finance.groups.yahoo.com/group/amibroker/message/148924 > > >> PS. Removing my earlier response and repeating your post four times does not >> add any strength to your argument. >> > I never removed your response (I guess it is impossible to remove someone > else's post). > I did remove my own duplicated posts, which I accidentally posted after > experiencing Yahoo server timeouts on Sunday evening. > > Thank you > John > > > > > ------------------------------------ > > **** IMPORTANT PLEASE READ **** > This group is for the discussion between users only. > This is *NOT* technical support channel. > > TO GET TECHNICAL SUPPORT send an e-mail directly to > SUPPORT {at} amibroker.com > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > http://www.amibroker.com/feedback/ > (submissions sent via other channels won't be considered) > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > Yahoo! Groups Links > > > > >
