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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    54 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    34 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    57 views
    0 likes
    Last Post PaulMohn  
    Working...
    X