I have VERY interesting problem with ninjatrader...
as you can see in attached picture, strategy is taking more and more contracts.
for example at 11:31 is the strategy working with 3 or 4 contracts.
But the interesting thing is that in the source code of the enter is this:
if (CrossBelow(Close, Open, 1)
&& Position.MarketPosition!=MarketPosition.Long
&& ToTime(Time[0]) > ToTime(startOfBuyZone_hour, startOfBuyZone_minute, 0)
&& ToTime(Time[0]) < ToTime(endOfBuyZone_hour, endOfBuyZone_minute, 0)) {
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -17 * TickSize, Color.Blue);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
EnterLong();
SetStopLoss(CalculationMode.Ticks, stopLossTicks);
SetProfitTarget(CalculationMode.Ticks, profitTargetTicks);
return;
}
You can see that in the conditions of source code for entering.
So how its possible that I have so much contracts ???
When you will run the strategy on historical data (backtest) you will see its working good. But on realtime data (simulated data) its buying and selling lots of contracts in the order. Why???
Thank you for advice.


Comment