Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsArray question again

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

    BarsArray question again

    Of course, this does not work for BarsArray with regard to the close. Is there a correct way to do it or am I wasting time?

    if (Close(BarsArray[1])[0]

    do something........

    Thannks!

    #2
    edgeliner, you could just use Closes[1][0] here - it would allow access to all close values for the bars series you Add()ed.

    Comment


      #3
      I realize that Bertrand....... but I am trying to check the closes on different time frames. If I run the strategy on the 5 minute chart and want to check the close on the 15, 30, and 60 minute charts..... I assume I have to use BarsArray right?

      Comment


        #4
        You would then use the Closes with the appropriate Bars index fed in, so if you added in this order

        15, 30, 60 min

        Then Closes[2][1] would be the close of the 30 min frame one bar ago.

        Comment


          #5
          Perfect....THANKS!

          Comment


            #6
            Bertrand...... how come when I use this (below) it does not wait until the end of the hour to take a trade?

            running on the 5 minute chart...........

            Add(PeriodType.Minute, 15);
            Add(PeriodType.Minute, 30);
            Add(PeriodType.Minute, 60);

            if (Position.MarketPosition == MarketPosition.Flat
            && Closes[1][0] > Opens[1][0] && Closes[2][0] > Opens[2][0] && Closes[3][0] > Opens[3][0] && Close[0] > Open[0])
            {
            EnterLong(100000, "");
            }

            Comment


              #7
              In which BarsInProgress do you act then? I don't see you waiting for a hourly chart update (BIP 3) call.

              Comment


                #8
                I figured that because Closes[3][0] > Opens[3][0] has not happened yet, the if statement was not acted upon????

                Comment


                  #9
                  It would always evaluate, what the outcome would be depends on the CalculateOnBarClose setting you would use. If false, the current developing bar is used, if true the last closed bar is used. However this will not replace filtering logic by BarsInProgress to designate on which bar update event to act, otherwise if unfiltered OnBarUpdate() listens to all update calls.

                  Comment


                    #10
                    OK....that explains it.....thanks.........

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    650 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    370 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    109 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    574 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    577 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X