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 Waxavi, Today, 02:10 AM
          0 responses
          3 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          9 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          2 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by elirion, Today, 01:36 AM
          0 responses
          4 views
          0 likes
          Last Post elirion
          by elirion
           
          Started by gentlebenthebear, Today, 01:30 AM
          0 responses
          4 views
          0 likes
          Last Post gentlebenthebear  
          Working...
          X