Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT7 Multiple OnMarketData on one indicator

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

    NT7 Multiple OnMarketData on one indicator

    I made four separate indicators, all calculate a similar result with slight variations. They all work fine. Each uses:

    protected override void OnMarketData(MarketDataEventArgs e)
    My goal is to combine all four into one indicator, which means I need four OnMarketData on one indicator. I changed all variables in the OnMarketData script and changed the "e" at the end of EventArgs. I still get errors. The error I get is

    'indicator already defines a member called OnMarketData with the same parameter type.'

    Then when I try to use only one "protected override void OnMarketData(MarketDataEventArgs e)" and run the other 3 scripts under the one OnMarketData, again all the variables are unique, the error is

    'the name 'variable' does not exist in the current context'. The variable it's referring to is the unique name I give the "e" after EventArgs.

    This has nothing to do with the math of the code, that's all fine. I just need to know how to run these scripts on one indicator.

    Thank you.

    #2
    Hello imalil,

    Thank you for writing in.

    You can only have one OnMarketData() overridel in your indicator.

    With a multi-time frame/multi-instrument script, OnMarketData() will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnMarketData() method for a specific instrument. (BarsInProgress will return the first BarsInProgress series that matches the instrument for the event).

    Please take a look at the help guide at this link for more information about OnMarketData(): https://ninjatrader.com/support/help...marketdata.htm

    For more information about working with multiple instruments and/or multiple timeframes in a script, please take a look at this help guide link: https://ninjatrader.com/support/help...nstruments.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    557 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X