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.

    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.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          68 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          39 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          62 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X