how to flip a buffer?

 

when I create a buffer with CopyBuffer through iCustom we find the buffer upside down, in practice, if we take a buffer of size 5, the last value will be taken with buffer [4 [.
I would like to flip the buffer and take the last value with buffer [0].
By last value I mean the value corresponding to the candle that is in formation, so I would like the last candle in formation to be buffer [0] as for iOpen, iClose etc ...
is there any way to flip the buffer?

thank you

 

Yes,


ArraySetAsSeries is the way to go.

https://www.mql5.com/en/docs/array/arraysetasseries
 
Dominik Christian Egert #:

Yes,


ArraySetAsSeries is the way to go.

https://www.mql5.com/en/docs/array/arraysetasseries

thanks for reply.

I sew ArrayReverse() too, what about it?

it seems works

 
CaneRandagio #: I sew ArrayReverse() too, what about it?

As-series changes a bit for element access.

ArrayReverse moves every element; very expensive for large arrays.

 
William Roeder #:

As-series changes a bit for element access.

ArrayRevers moves every element; very expensive for large arrays.

ok thanks!
Reason: