Hi All, I'm trying to code an entry that adds a ATR number to the previous consecutive number of 3 higher highs (Short trade) and 3 lower lows (Long Trade) per the following. Any assistance appreciated:
MovingAv1 = MA(C, 100);
MovingAv2 = MA(C, 5);
MyATR = 0.5 * ATR(10);
// Long Signal
// 1) Close > 100 day MA
// 2) Close < 5 day MA
// 3) 3 consecutive lower lows
// 4) Set next day Limit Buy order below prior Close @ 0.5 x 10 day ATR
// Long Exit - close is > prior close, then exit @ next day's open
Buy = C > MovingAv1 AND Ref(C, -1) > MovingAv1 AND Ref(C, -2) > MovingAv1 AND Ref(C, -3) > MovingAv1 AND
C < MovingAv2 AND Ref(C, -1) < MovingAv2 AND Ref(C, -2) < MovingAv2 AND Ref(C, -3) < MovingAv2;
// Short Signal
// 1) Close < 100 day MA
// 2) Close > 5 day MA
// 3) 3 consecutive higher highs
// 4) Set next day Limit Sell order above prior Close @ 0.5 x 10 day ATR
// Short Exit - close is < prior close, then exit @ next day's open
Sell = C < MovingAv1 AND Ref(C, -1) < MovingAv1 AND Ref(C, -2) < MovingAv1 AND Ref(C, -3) < MovingAv1 AND
C > MovingAv2 AND Ref(C, -1) > MovingAv2 AND Ref(C, -2) > MovingAv2 AND Ref(C, -3) > MovingAv2;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
PlotShapes(Buy*shapeUpArrow, colorGreen, 0);
PlotShapes(Sell*shapeDownArrow, colorRed, 0);