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 itrader46, Today, 10:22 AM
          0 responses
          2 views
          0 likes
          Last Post itrader46  
          Started by NM_eFe, Today, 10:13 AM
          0 responses
          1 view
          0 likes
          Last Post NM_eFe
          by NM_eFe
           
          Started by hdge4u, Yesterday, 12:23 PM
          1 response
          10 views
          0 likes
          Last Post hdge4u
          by hdge4u
           
          Started by 1001111, Today, 09:45 AM
          0 responses
          4 views
          0 likes
          Last Post 1001111
          by 1001111
           
          Started by DTSSTS, 01-28-2024, 12:07 PM
          11 responses
          557 views
          0 likes
          Last Post bmo111
          by bmo111
           
          Working...
          X