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 argusthome, 03-08-2026, 10:06 AM
          0 responses
          71 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          43 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          25 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          28 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          56 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X