What I did to "solve" the problem of looking into the future with Zig-Zag was to just add in a trade delay.
Example: Tomasz has written a double-top pattern detector here... http://www.amibroker.com/library/detail.php?id=19&hilite=PEAK ...and in the line "buy = doubletop;" I modified it to say "buy=ref(doubletop,-5);". Zig-Zag doesn't "know" that a peak was made until a few bars go by after the suspected "peak", so you add that number of days to the signal generated by Zig-Zag. (You need to decide how many days it takes to validate a peak/trough.) Sebastian --- In [email protected], "rijnaars" <rij...@...> wrote: > > Thanks Mike, can you tell me where i should correct the signals to no longer > look in the future > > --- In [email protected], "Mike" <sfclimbers@> wrote: > > > > 1. You cannot trade a system that uses Zig unless you correct the signals > > to no longer be looking into the future. What you have now *looks into the > > future*, just be aware of that. > > > > 2. Zig is the name of a function, you cannot use it without providing the > > function arguments. > > > > e.g. > > Condition1 = Zig > Ref(Zig, -1); <-- this is wrong > > > > Instead do > > > > PZig = Zig(P, change); > > Condition1 = PZig > Ref(PZig, -1); > > > > Mike > > > > --- In [email protected], "rijnaars" <rijnaa@> wrote: > > > > > > _SECTION_BEGIN("ZIG - Zig"); > > > P = ParamField( "Price field" ); > > > change = Param("% change",5,0.1,25,0.1); > > > Plot( Zig(P, change), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), > > > ParamStyle("Style") ); > > > > > > Condition1=Zig>Ref(Zig,-1); > > > Condition2=Ref(Zig,-1)<Ref(Zig,-2); > > > Condition2=Zig<Ref(Zig,-1); > > > > > > Buy= Condition1; > > > Sell= Condition2; > > > > > > shape = Buy * shapeUpArrow + Sell * shapeDownArrow;//No same day buy sell > > > possible > > > PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, > > > High ) );; > > > > > > _SECTION_END(); > > > > > > I get the next errors > > > > > > ln6 col15: error 31 syntax error expecting "(" > > > ln7 col15: error 31 syntax error expecting "(" > > > ln8 col15: error 31 syntax error expecting "(" > > > ln10 col16: error 29 variable condition1 used without having been > > > initialized. > > > ln11 col17: error 29 variable condition1 used without having been > > > initialized. > > > > > >
