Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What to add for a multiple of ATR in BarArray and double checking what to compare.

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

    What to add for a multiple of ATR in BarArray and double checking what to compare.

    Hi folks:

    What would I add to this to make it a multiple (i.e. 2 times the atr) of ATR with a BarArray on daily?

    Code:
    		protected override void Initialize()
                          Add(PeriodType.Day, 1); 
    
                    protected override void OnBarUpdate()
                          if (Close[0] > ATR (BarsArray[1], 14)
    Also, should I use "Close" or something else to compare the ATR with to make it work correctly? I basically would like the current day's range with the BarArray's ATR from daily bars. I have a feeling I should use something other that "Close".



    Greg

    #2
    Hello Greg,

    Thank you for your post.

    I do not fully understand your inquiry. Are you trying to check the ATR's High and Low for the day? Where are you comparing the 2 times ATR value of the day? What value do you want to compare it against?

    I look forward to your response.

    Comment


      #3
      Patrick...

      Hi...

      Yea...current days range at each bar close of the primary data series with the average true rage of the last 14 days per the barsarray series...

      is that better?

      I am mobile fyi...smile...

      Greg

      Comment


        #4
        Hello Greg,

        Thank you for your response.

        So compare the ATR against the High and Low of the day at close?

        Comment


          #5
          Compare the current day's range against the ATR (from bararray).

          Comment


            #6
            Hi birdog,

            To get the current range of the day:

            double daysRange = CurrentDayOHL().CurrentHigh[0] - CurrentDayOHL().CurrentLow[0];

            then:

            if (daysRange > ATR (BarsArray[1], 14)[0])
            {
            // do something
            }

            Comment


              #7
              How would it be written to do:

              If the current days range is greater that 1.5 times the ATR's BarsArray from the last 14 days?

              Also, I could not get the "double" value to compile (what section does that go)?

              Comment


                #8
                Hi Greg,

                Thanks for your question.

                I have changed the code below so that the days range must exceed the 14 day ATR * 1.5.

                The code compiles as is without errors and can be placed below OnBarUpdate()

                Code:
                [COLOR="RoyalBlue"]double[/COLOR] daysrange = CurrentDayOHL().CurrentHigh[0] - CurrentDayOHL().CurrentLow[0];
                
                if (daysrange > (ATR (BarsArray[1], 14)[0])*1.5)
                {
                [COLOR="SeaGreen"]// Do something here[/COLOR]
                }
                Please let me know if I can be of further assistance.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                580 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                335 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                102 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                554 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                552 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X