if (Stochastics(StoPeriodD, StoPeriodK, StoSmooth).K[0] < 20)
{
Print("Stochastic this bar" + Stochastics(StoPeriodD, StoPeriodK, StoSmooth).K[0]);
Print("Time:" + Time[0]);
if (Stochastics(StoPeriodD, StoPeriodK, StoSmooth).K[0] > Stochastics(StoPeriodD, StoPeriodK, StoSmooth).K[1])
{
if (atmStrategyIdS.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyIdS) == Cbi.MarketPosition.Short)
{
AtmStrategyChangeStopTarget(0, breakevenplusS, "STOP1", atmStrategyIdS);
AtmStrategyChangeStopTarget(0, breakevenplusS, "STOP2", atmStrategyIdS);
AtmStrategyChangeStopTarget(0, breakevenplusS, "STOP3", atmStrategyIdS);
Print("Stochastic after move" + Stochastics(StoPeriodD, StoPeriodK, StoSmooth).K[0]);
Print("Breakeven plus" + breakevenplusS);
Print("Time:" + Time[0]);
}
}
}
I want to move my stop when Stochastic reaches below 20 and the stochastic of the current is greater than the stochastic on the last bar. It works when the stochastic only reaches below 20 once but if stochastic will stay below 20 for 3 bars it will not work.

Comment