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

AddDataSeries() with OnMarketData()

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

    AddDataSeries() with OnMarketData()

    I am building multi time frame scripts, I have done it with "normal" values, level 1 values, without too much difficulty. But I have some values that I can only get using OnMarketData(). When I try to make a multi time frame script using values from OnMarketData() it doesn't work. I don't get errors, but my values are wrong. I've been reading the support material but I can't find a similar example.

    Is there an example of AddDataSeries() with OnMarketData() on your site that you can link me so I can learn how it's done? It's easiest for me to learn if I can see an indicator and emulate it.

    Thank you.

    #2
    Hello imalil,

    With OnMarketData(), this is no longer ties to bars in OnBarUpdate(), so BarsInProgress is no longer involved. Instead, All series added with the same Instrument will update OnMarketData() with that instrument.

    Compare the Instrument to the BarsArray series Instrument if you want to know if a bars series has it's instrument updating in OnMarketData().
    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
    Print(marketDataUpdate.ToString());
    if (marketDataUpdate.Instrument == BarsArray[0].Instrument)
    {
    Print("Instrument of market data update is same as primary");
    }
    }
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by xepher101, 05-10-2024, 12:19 PM
    4 responses
    51 views
    0 likes
    Last Post xepher101  
    Started by DawnTreader, 05-08-2024, 05:58 PM
    22 responses
    82 views
    0 likes
    Last Post DawnTreader  
    Started by Mathias79, Today, 03:44 PM
    0 responses
    17 views
    0 likes
    Last Post Mathias79  
    Started by Austiner87, Today, 03:42 PM
    0 responses
    12 views
    0 likes
    Last Post Austiner87  
    Started by lorem, 04-25-2024, 09:18 AM
    19 responses
    84 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X