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

number of issues with adddataseries().

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

    number of issues with adddataseries().



    good day to everyone,



    i have been evaluating some strategies that would monitor one instrument for signals for entries and exits but place the trades on another separate instrument.


    i was told to use the adddataseries() command and i have managed to get some basic strategies to work as desired. however, i have also tried some minor modifications so that inputs like the contract month and interval size would not have to be hard coded in the strategies but could be modified as inputs and these changes have caused the strategies to stop working.



    i have used the strategy builder to add two data series to my strategies and this fragment works without problem:


    Minutes = 5;

    }
    else if (State == State.Configure)
    {
    AddDataSeries("6E 03-19", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
    AddDataSeries("M6E 03-19", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
    }



    if i try this modification below, the strategy will compile but then it won't make any trades:


    Minutes = 5;

    }
    else if (State == State.Configure)
    {
    AddDataSeries("6E ##-##", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
    AddDataSeries("M6E ##-##", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
    }

    ¿is there any way to properly use continuous contracts with the adddataseries() command so that it wouldn't be necessary to change the code every time a contract expires?



    i have also tried to make the interval size an input so that the strategy could be adjusted easily from the strategy analyzer and even optimized on that parameter. when i try this structure below the strategy will verify but once again it won't place any trades:


    Minutes = 5;

    }
    else if (State == State.Configure)
    {
    AddDataSeries("6E 03-19", Data.BarsPeriodType.Minute, Convert.ToInt32(Minutes), Data.MarketDataType.Last);
    AddDataSeries("M6E 03-19", Data.BarsPeriodType.Minute, Convert.ToInt32(Minutes), Data.MarketDataType.Last);
    }

    ¿is it possible to have the bar size for additional data series as an input and not hardcoded in the strategy itself?



    very well, thanks, regards.

    #2
    Hello rtwave,

    Continuous contract data is not provided by all provider types, and orders cannot be sent to brokers on continuous contracts.

    Should you be using Kinetick data which does support continuous contracts, you could hard code instruments with continuous contract expiry month symbols (##).

    Further, AddDataSeries() cannot be used with dynamic variables so a workaround such as the logic used in the RolloverIndications indicator would not be supported with AddDataSeries().

    From the help guide:
    "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."

    Below is a link to the help guide on AddDataSeries().
    https://ninjatrader.com/support/help...dataseries.htm


    I will submit a feature request on your behalf for the development team to consider allowing dynamic variables as parameters to AddDataSeries().

    Once I have an ID for this request I will post in this thread for future reference.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello rtwave,

      I've received tracking ID# SFT-882 for this request to dynamically load data series with variables as parameters in AddDataSeries().

      Please note it is up to the NinjaTrader Development to decide if or when any request will be implemented.

      We appreciate your feedback on this.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by adeelshahzad, Today, 03:54 AM
      5 responses
      32 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by stafe, 04-15-2024, 08:34 PM
      7 responses
      32 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by merzo, 06-25-2023, 02:19 AM
      10 responses
      823 views
      1 like
      Last Post NinjaTrader_ChristopherJ  
      Started by frankthearm, Today, 09:08 AM
      5 responses
      22 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      43 views
      0 likes
      Last Post jeronymite  
      Working...
      X