-------------
/* two bar high/low backtest. trade entered when 1 pip higher than tbh or 1 pip lower than two bar low. stop is trailed two bars behind extreme
*/
AbsHighDiff = abs(H - Ref(H, -1));
AbsLowDiff = abs(L - Ref(L, -1));
tbh = AbsHighDiff < 0.02; // max. 2 pips difference
tbl = AbsLowDiff < 0.02; // max. 2 pips difference
PositionSize = -33;
tbhyesterday = Ref( tbh, -1 ); // new array - tbh shifted forward 1 bar
tblyesterday = Ref( tbl, -1 ); // new array - tbl shifted forward 1 bar
HigherHigh = High > Ref( High, -1 );
LowerLow = Low < Ref( Low, -1 );
Buy = tbhyesterday AND HigherHigh;
BuyPrice = Ref ( High, -1 );
Sell = L < Ref(LLV(L,2),-1);
SellPrice = Ref(LLV(L,2),-1);
Short = tblyesterday AND LowerLow;
ShortPrice = Ref ( Low, -1 );
Cover = H > Ref( High, -2 );
CoverPrice = Ref ( High, -2 );
----------------------