Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Secondary symbol in NT8

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

    Secondary symbol in NT8

    Hi,

    I have a NT7 indicator which plot value for a secondary symbol (to be used for spread),
    I can't plot the same in NT8.

    Thats my code:
    Code:
    #region Variables      
    private string symbol2 = @"^SP500"; // Default setting for Symbol2
    #endregion
    
    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;
    if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
    return;
    Value[0] = Closes[1][0];
    }
    I'm repeating the same in NT8 but the indicator doesn't plot anything (please see attached code).
    Am I missing something in NT8?

    Thanks.
    Attached Files
    Last edited by MAX; 10-02-2016, 12:36 PM. Reason: Want to delete- Problem solved

    #2
    Hello MAX,

    Thank you for your note.

    Under State.Configure in NinjaTrader you may be using,
    Add(“^SP500”, PeriodType. Daily, 1);

    However in NinjaTrader 8, you should use,
    AddDataSeries("^SP500", Data.BarsPeriodType.Day, 1);

    Which would allow your logic under OnBarUpdate() you’ve shared to successfully plot the value of SP500, assuming you also have something like AddPlot(Brushes.Blue, "myPlot"); under State.Configure as well.

    Please see Code Breaking Changes from NT7 to NT8.


    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    162 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    312 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    245 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X