I am trying to wrap my head around this Moving Stop
if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] < Open[1])))
Value[0] = (Low[1] + (-SubtractTicksforLongStop * TickSize));
the above finds the first instance, but as more Close > Open occur after the red bar of course the stop is NOW na
How do I approach retaining the STOP at that level until the next RED bar occurs again followed by a GREEN Bar
thanks
Attempt the long way to just write more condition sets, this compiles but creates an LOG error
if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] < Open[1])))
Value[0] = (Low[1] + (-SubtractTicksforLongStop * TickSize));
if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] > Open[1]) && (Close[2] < Open[2])))
Value[0] = (Low[2] + (-SubtractTicksforLongStop * TickSize));
if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] > Open[1]) && (Close[2] > Open[2]) && (Close[3] < Open[3])))
Value[0] = (Low[3] + (-SubtractTicksforLongStop * TickSize));
ERROR error on calling OnBarUpdate method on bar 1. You are accessing an index with a value that is invalid since it is out of range.
Thanks

Comment