Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change parameter with change of time frame

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

    Change parameter with change of time frame

    Hello Support,
    I would like to change the value of a parameter in an indicator, depending on the time interval of the candles, along the lines as follows
    if time interval = M60, then parameter X = xx, else if time interval = M30, then parameter X = yy, then use the parameter X in a following indicator.
    Thank you for any help provided.

    #2
    OldHiker, you would use the BarsPeriod Id and Value here to adjust your settings then based on timeframe selected.



    if (BarsPeriod.Id == PeriodType.Minute && BarsPeriod.Value == 30)
    {
    myParameter = 30;
    }

    Then you can pass the variable set to your indicator method to provide the adjustement.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello Bertrand,
      Thank you for your reply. I had gone to that section of the manual several times, but I did not know how to translate this to my case.
      Your sample code is what I needed.
      Thank you

      Comment


        #4
        Back again.
        I am very pleased at what I can do with this snippet of code.
        Thank you

        Comment


          #5
          Glad to hear that helped you improve your custom codes OldHiker, all the best.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by samish18, Today, 01:01 PM
          0 responses
          4 views
          0 likes
          Last Post samish18  
          Started by WHICKED, Today, 12:56 PM
          0 responses
          7 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Started by Spiderbird, Today, 12:15 PM
          2 responses
          11 views
          0 likes
          Last Post Spiderbird  
          Started by WHICKED, Today, 12:45 PM
          0 responses
          8 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Started by FrazMann, Today, 11:21 AM
          2 responses
          8 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X