- Joined
- 30 June 2007
- Posts
- 7,200
- Reactions
- 1,225
Thanks Gringotts. I was then looking for price to close back down below the high of the previous pivot.
I don't think that can be done if the swing is calculated using Zig eg:
Buy = H>(Ref(swinghi,-1)) AND C<(Ref(swinghi,-1)) ;
I've been trying this but for some reason AB won't have it and misses many signals
Logic seems correct to me.
SwingHi= H>Ref(H,-1) AND H>Ref(H,1);
BO= (L>ValueWhen(swingHi,H,1)) AND (C<ValueWhen(swingHI,H,1));
PlotShapes(shapeSmallCircle*SWINGHi,colorBLUE, 0, H, 20);
Buy = SwingHi;
This is the JHX daily chart for example. Note no green arrow buy signal on yesterday's candlestick? But there was one correctly identified 4 days ago.
View attachment 66545
Plot this, so you can see the zig line, then backtest. You'll see it works for what you want.
[edited]
swinghi= Peak(H,5,1);
Buy = H>ref(swinghi,-1) AND C<Ref(swinghi,-1);
Sell = False;
Plot(Zig(H,5),"",colorBlack);