Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close[0] price is showing erratic values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Close[0] price is showing erratic values

    Hello

    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


    #2
    Hello, thanks for writing in. If your script does not add any extra series, you can set the Order Fill Resolution to High>1 Tick to improve the order fill accuracy in your backtest. See here for more information on intrabar granularity:

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    49 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    141 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    275 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X