Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ScottWalsh, Today, 06:52 PM
    4 responses
    32 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    4 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    19 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    6 views
    0 likes
    Last Post cre8able  
    Started by Haiasi, Today, 06:53 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X