Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing the periodtype & value of strategy

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

    Accessing the periodtype & value of strategy

    Hi,

    I'm trying to add another symbol to my strategy in the initialize section. I would like to have the symbol added with the same periodtype and periodvalue than the symbol for which the strategy runs.

    I'm now using a parameter, but the value of the parameter is not automaticly in sync.

    How can I access them, because initialize will not accept Bars.Periodtype.

    #2
    Hi, unfortunately symbols can't be added dynamically.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I now have:
      Add(strInstr, bPeriodtype, bValue)

      and on the parameterform I give the variables a value.
      I found the NinjaTrader.Data.PeriodType enum. What is the enum for a symbollist?

      Comment


        #4
        Unfortunately this is not supported. You just have to type in string values for the instrument you want.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          To match the PeriodType and Period selected in the Strategy use the following code in Initialize()

          string instrument = "^SP500";
          PeriodType periodType = (PeriodType) Enum.Parse(
          typeof(PeriodType), BarsPeriod.Id.ToString());
          Add(instrument, periodType, BarsPeriod.Value);

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Fitspressorest, Today, 01:38 PM
          0 responses
          2 views
          0 likes
          Last Post Fitspressorest  
          Started by Jonker, Today, 01:19 PM
          0 responses
          2 views
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          6 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,791 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          844 views
          0 likes
          Last Post emuns
          by emuns
           
          Working...
          X