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 rocketman7, Today, 01:00 AM
          0 responses
          1 view
          0 likes
          Last Post rocketman7  
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          27 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 04-23-2024, 09:53 PM
          2 responses
          74 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          193 views
          0 likes
          Last Post Hasadafa  
          Working...
          X