I can see the errors are telling me I'm trying to put my stop above the market but that's not the case. I have written a custom stop chasing strategy but I don't see how it could cause this.
What's confusing is that the prices the error references seem to be from the previous trade (See chart image - the error references 3310.00 & 3310.15 yet the new order is at 3326)
Here is my entry code
if (goodToTradeLong == true && Position.MarketPosition == MarketPosition.Flat){ // if I have no active trades and I'm ready to go Long EnterLong(contracts,"MACD Oppourtunity Long "+ Time[0]); SetStopLoss(CalculationMode.Ticks, InitialStopLoss); SetProfitTarget(CalculationMode.Ticks, InitialTakeProfit); } else if (goodToTradeShort == true && Position.MarketPosition == MarketPosition.Flat){ // if I have no active trades and I'm ready to go Short EnterShort(contracts,"MACD Oppourtunity Short "+ Time[0]); SetStopLoss(CalculationMode.Ticks, InitialStopLoss); SetProfitTarget(CalculationMode.Ticks, InitialTakeProfit); }
if (Position.MarketPosition == MarketPosition.Short && Ask < High[0]){ //If we're short & it's been a bar since entry if (goodToTradeLong == true){ //if price is higher than where the stop will be, exit trade ExitShort(); } else if (Ask - High[0] >= 0.5){ // If price is going to be within half a point to the stop, allow more room SetStopLoss(CalculationMode.Price, (High[0] + 1)); } else { SetStopLoss(CalculationMode.Price, High[0]);//Otherwise move the stop to the previous high SetProfitTarget(CalculationMode.Ticks, CrazyTakeProfit); NinjaTrader.Code.Output.Process("Moving Stop Down", PrintTo.OutputTab1); } } /* Auto Stop Loss Long */ if(Position.MarketPosition == MarketPosition.Long && Ask > Low[0]){ if (goodToTradeShort == true){ //if price is lower than where the stop will be, exit trade ExitLong(); } else if (Ask - Low[0] <= 0.5){ // If price is going to be within half a point to the stop, allow more room SetStopLoss(CalculationMode.Price, (Low[0] - 1)); } else { SetStopLoss(CalculationMode.Price, Low[0]); //Otherwise move the stop to the previous low and add 1 to Moved SetProfitTarget(CalculationMode.Ticks, CrazyTakeProfit); NinjaTrader.Code.Output.Process("Moving Stop Up", PrintTo.OutputTab1); } }
I don't need OCO as I check I'm flat before entry so if there's a way I can disable it that would be ideal but any ideas are appreciated.
Many Thanks
Comment