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 James650, 05-07-2024, 08:25 AM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by xepher101, 05-10-2024, 12:19 PM
    5 responses
    66 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Vitamite, Yesterday, 12:48 PM
    3 responses
    18 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by aligator, Today, 02:17 PM
    0 responses
    17 views
    0 likes
    Last Post aligator  
    Started by lorem, 04-25-2024, 09:18 AM
    22 responses
    96 views
    0 likes
    Last Post lorem
    by lorem
     
    Working...
    X