Download MetaTrader 5

bars informations, anyone has knowledge of how to get it?

To add comments, please log in or register
All articles are available from MetaTrader 5. Contribute your own one!
liquidd
172
liquidd 2013.12.09 23:43 

hi, I'm looking for someone who has knowledge on how to get the informations about the last closed bar in my chart. I have been trying to figure out witch one it with

count = IndicatorCounted()-1

or something like

count = Bars-1

count = iBars(Symbol(),Period_D1 )-1

or else

high = iHigh(Symbol(),Period_D1,1);

low = iLow(Symbol(),Period_D1,1);

I'm very confused about witch one to use so if someone can tell me what would be right to use for these high and low values it would be much appreciated

then

if anyone knows about this I would really love to know the high and low price of this last complete bar in my chart and use these values for my EA.

thank you for anyone who could possibly point me the right way to do it

Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.12.10 00:00  
liquidd:

hi, I'm looking for someone who has knowledge on how to get the informations about the last closed bar in my chart. I have been trying to figure out witch one it with


The last closed bar is bar number 1 . . .
liquidd
172
liquidd 2013.12.10 00:10  
RaptorUK:
The last closed bar is bar number 1 . . .


so the iHigh and Ilow I stated would be the right one? is it?
Ubzen
5394
Ubzen 2013.12.10 00:12  
liquidd: so the iHigh and Ilow I stated would be the right one? is it?

Yes.... This is the very basic stuff. If you're going to program I'll recommend understanding the bar index.

https://www.mql5.com/en/articles/1475

whroeder1
14514
whroeder1 2013.12.10 01:25  
liquidd: how to get the informations about the last closed bar in my chart.

high = iHigh(Symbol(),Period_D1,1);

low = iLow(Symbol(),Period_D1,1);

  1. The last close of your chart is Close[1]. The last high and low of your chart is High[1] and Low[1]. The last high and low of the D1 chart is what you posted. Not the same thing unless your chart happens to be the D1 chart.
  2. count = IndicatorCounted()-1 
    Indicator don't worry about any such things. then compute all bars on their current chart
    int count = indicatorCounted();
    if(count < LOOKBACK) count = LOOKBACK;
    for(int iBar = Bars - 1 - count; iBar >= 0; iBar--) Buffer[iBar] = ...;

To add comments, please log in or register