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 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