Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

custom calculated chart

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

    custom calculated chart

    Hi,

    I would like to chart the difference between two instruments (like spread) but with a calculation included.

    for example Crude oil 04-15 - (minus) (crude oil 05-15 * 2)

    so that is Crude oil april 2015, minus crude oil may 2015 times 2.

    hope this makes sense.

    Thanks

    #2
    Hello,

    It would be possible to accomplish this with a bit of custom programming in NinjaScript. You could add a secondary data series within the code, then perform calculations involving both data series.

    If you would like to go the custom programming route, I'll be more than happy to point you in the right direction as to how this can be done.

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Thanks Dave, i'll have a crack at it.. i'm assuming i'll be building an indicator?

      Comment


        #4
        Hello,

        That's correct. You will need to use Add() to add a secondary data series, and Closes[int barSeriesIndex][int barsAgo] to access the close prices of bars on either data series. You can find more about Add() and Closes at the links below:

        Add(): http://www.ninjatrader.com/support/h....html?add3.htm

        Closes: http://www.ninjatrader.com/support/h...tml?closes.htm

        Please let me know if I can assist further.
        Dave I.NinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        117 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        166 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        85 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        130 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        88 views
        0 likes
        Last Post PaulMohn  
        Working...
        X