Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate Closes[1][0] historicall

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

    Calculate Closes[1][0] historicall

    Hello. I'm trying to calculate diffirence between Close price of one series and Close price of the seconday series (f.e. GC 02-20 and GC 04-20).
    When I'm setting

    Value[0] = Closes[1][0] - Closes[0][0];

    It calculates me only in real-time. On historicall period via Print(Value[0]); I see that Close prices are the same as primary Series.
    How can I resolve this problem? And one more thing:
    I saw in real-time that first Setting (via print) shows the current Closes[0][0] and then, in some seconds it changes to the value of secondary series.

    Help please.

    #2
    Hello YevhenShynkarenko,

    Thanks for your post.

    Merge Policy will merge previous contract month data to the current contract month. GC 04-20 is set to roll on 01/29/2020 so any data before then would be merged from the previous contract month. This would result in the historical data resulting in a 0 comparison and then the realtime data updating with the data from those contract periods.

    If you set Merge Policy to Do Not Merge, you should be able better see the differentiation on separate charts and see how realtime and historical get their result from your indicator. To move forward with your goal, I may suggest cloning the instrument, and then adjusting the rollover periods so you can compare more current data on the future contract month with the older contract month.

    Merge Policy - https://ninjatrader.com/support/help...rge_policy.htm

    Editing Instruments - https://ninjatrader.com/support/help...nstruments.htm

    Please let me know if I can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    82 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X