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

MultiInstrument / Multi parameter setting

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

    MultiInstrument / Multi parameter setting

    Hi @all,

    I'm currently thinking about which is the best implementation, related for performance and ressource overhead...

    Here is the description of waht I like to do:
    I'm using an indicator which has for each instrument an individual setting. If I like to bind it to a large list of equitie like the NASDAQ100 it's not really a nice to handle...

    So I have written an individual MarketAnalyzer column with the following implementation for the state:

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"";
    Name = "MPMulti";
    Calculate = Calculate.OnBarClose;
    Instruments = "nasdaq100.csv";
    }
    else if (State == State.Configure)
    {
    [I] _instruments = LoadFromFile(Instruments); // loading structs for each instrument parameters
    _indicators = new Indicators.TrendBIndicator[_instruments.Length]; // initialize the array of indicators
    // adding the series for each instrument
    for(int i = 0; i < _instruments.Length; i++)
    {
    var xi = _instruments[i];
    AddDataSeries(xi.Instrument);
    }
    }
    else if(State == State.DataLoaded)
    {
    // setting for each indicator parameters
    for(int i = 0; i < _instruments.Length; i++)
    {
    var xi = _instruments[i];
    _indicators = TrendBIndicator(BarsArray[i+1], xi.RSIPeriod,xi.RSILongEntry, xi.RSILongExit, xi.RSIShortEntry, xi.RSIShortExit, xi.SMAPeriod, xi.ADXPeriod, xi.ADXLimit);
    }
    }
    }

    Maybe there is a beter way to solve that problem?

    Many thx for your suggestions
    Markus


    #2
    Hello mphilipp,

    Thanks for your post.

    Performance wise, you may see an impact if you have many instruments added on the Market Analyzer. If you add a print in State.Configure, you may see that this state will be reached for each instrument added in your Market Analyzer. This would ultimately cause AddDataSeries() to be called numerous times when it would not be necessary.

    You could also devise a test by either testing your column against a Market Analyzer with 1 instrument, and with 100 instruments. I have taken this approach adding 30 data series in the Market Analyzer Column and the impact was clearly visible with 100 instruments on the Analyzer.

    Based on these tests, I would recommend configuring indicators individually to get the best performance.

    I can understand the pain point behind configuring each indicator individually for a large list of indicators. The idea of having indicator templates that would be functional the same way strategy templates are used could make this process easier, which I believe would be the ultimate solution. We have a feature request pending on this and I'll add a vote on your behalf based on what you are running into. The ticket ID is SFT-311.

    We cannot offer an ETA or promise of fulfillment, but we are tracking interest and the ticket ID number will be noted in the help guide when a new build gets released with the feature implemented.

    Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

    In the meantime, you may be able to take a similar approach to configure the indicator dynamically from within the indicator itself. Instrument will be known by State.DataLoaded, so you may be able to force configs from here. Items that would need to be set in State.Configure would not work for this approach, however.

    If there is anything else we can do to help, please let us know.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      many thx for your reply to my post...
      I'm looking forward for the SFT-311 meanwhile I'm reducing the numers of instruments for my solution.

      have a nice weekend

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Aviram Y, Today, 05:29 AM
      4 responses
      11 views
      0 likes
      Last Post Aviram Y  
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      26 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by bmartz, 03-12-2024, 06:12 AM
      3 responses
      30 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by gentlebenthebear, Today, 01:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by cls71, Today, 04:45 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X