[BUG] CopyHigh, iHigh and rates.high returning open price ?

To add comments, please log in or register
Bilal Said
546
Bilal Said  

hello guys,i wrote a simple code to get the High of the current candle but it gives me the open price instead.

        double Maxima_Candle[];
        CopyHigh(Symbol(),PERIOD_CURRENT,0,1,Maxima_Candle);
        MqlRates rates[];
        CopyRates(Symbol(),PERIOD_CURRENT,0,1,rates);
        Print("OPEN PRICE:"+iOpen(Symbol(),PERIOD_CURRENT,0));
        Print("HIGH:"+Maxima_Candle[0]);
        Print("HIGH2:"+iHigh(Symbol(),PERIOD_CURRENT,0));
        Print(HIGH3:"+rates[0].high);

datawindow and output


why all the methods are returning the open price instead the High ?

is it a bug or i'm doing something wrong ?
build 2007
25 feb 2019

Petr Nosek
1965
Petr Nosek  
Bilal Said:

hello guys,i wrote a simple code to get the High of the current candle but it gives me the open price instead.


why all the methods are returning the open price instead the High ?

is it a bug or i'm doing something wrong ?
build 2007
25 feb 2019

If you provide your code at the beginning of a candle then all the prices (Open, High, Low, Close) are the same because the candle contains just one price. But if you check the prices on the chart you get prices from a finished candle.

Bilal Said
546
Bilal Said  
Petr Nosek:

If you provide your code at the beginning of a candle then all the prices (Open, High, Low, Close) are the same because the candle contains just one price. But if you check the prices on the chart you get prices from a finished candle.

you are right, big mistake of mine.

To add comments, please log in or register