Can you please help on the below....
Close[0] price is showing erratic values when added to the chart window for simulation account.
The logic is written in the OnBarUpdate() event....
On the strategy back tester it seems to work fine. But when i tested on the chart in simulation mode the prices are jumping all over the place when using the print statement. Shown below the script output logs...
Disabling NinjaScript strategy 'AGStrategy1/268369812'
Enter Initial Long : Close[0] : 4131.25 Qty : 0 Average Price : 0
Enter Additional Long Close[0] : 4089.5 Qty : 1 Average Price : 4131
Enter Additional Long Close[0] : 4067.75 Qty : 2 Average Price : 4110.25
Exit Long Close[0] : 4138 Qty : 3 Average Price : 4096.16666666667
Enter Initial Long : Close[0] : 4137.25 Qty : 0 Average Price : 0
Exit Long Close[0] : 4178.5 Qty : 1 Average Price : 4137
Enter Initial Long : Close[0] : 4171.25 Qty : 0 Average Price : 0
Enter Additional Long Close[0] : 4121.75 Qty : 1 Average Price : 4171.25
Enabling NinjaScript strategy 'AGStrategy1/268369813' : On starting a real-time strategy - StartBehavior=WaitUntilFlat Position=MES 03-23 2L EntryHandling=All entries EntriesPerDirection=10 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=False SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On bar close IsUnmanaged=False
MaxRestarts=4 in 5 minutes
Script settings attached
Comment