I have an ignored order that does not make sense. Here is the message from the output window
On the chart you will find a blue candle that I have named "Signal Candle". (Pay attention only to the blue candle that i have marked - not the other blue candles on the chart) This is the candle that every calculation is based on within this strategy. The Entry orders (there are 2 of them) are placed when this candle closes. The stop orders and the initial profit target is placed when the entry orders have filled. Their placements are based on a percentage of the signal candle As soon as the profit target is hit, then the initial stop order from the second entry is changed and that order is called LongAdjustedStop.
LongAdjustedStop is the order that is being ignored.
The blue horizontal line across the chart is the longAdjustedStop price. That is the price that NinjaTrader is calculating based on the Signal Candle and it is correct. The problem is that NinjaTrader is saying that it is equal to or above the closing price of the candle. But, this order does not get called until "LongTarget" is filled which you can see the candle that this happened on and the order is significantly below the close of this candle. The price of the Stop can be seen on the snippet of the output window that is attached.
Here is the code that is used to enter the LongAdjustedStop order:
// Set the adjusted stop loss LONG
if (LongLimit != null
&& LongLimit.OrderState == OrderState.Filled
&& LongStopB != null
&& LongAdjustedStop == null)
{
LongAdjustedStop = ExitLongStop(0,true,positionSize,adjustedStopLong,"LongAdjustedStop","LongEntryB");
CancelOrder(LongStopB);
Print(Time[0] + " Hello, LongAdjustedStop is being called!");
LongStopB = null;
LongLimit = null;
}
Thank you very much for your help.


Comment