Newbie Question: Candlestick Properties

 

Hi

I'm new to MQL5 and forex trading, have written a basic EA to prove some of the syntax's and have this running on a demo account.

I would like to analyse previous candles noting the length and open / close prices.

x = candle[0].length;  // Last Candle
y = candle[1].length;  // Candle previous to last
if(x>y) print("last candle is longer than the previous one");

 Thanks

Rob 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 
RobLangley:

Hi

I'm new to MQL5 and forex trading, have written a basic EA to prove some of the syntax's and have this running on a demo account.

I would like to analyse previous candles noting the length and open / close prices.

OK,  but what is your question/issue/problem ?
 
RaptorUK:
OK,  but what is your question/issue/problem ?

:-)

Sorry can you give me a pointer to a function  that I can use to retrieve this information.  I have been looking through the MQL5 online reference guide but so far no luck 

Thanks

Rob 

 
RobLangley:

:-)

Sorry can you give me a pointer to a function  that I can use to retrieve this information.  I have been looking through the MQL5 online reference guide but so far no luck 

Ah I see . . . candle length is High - Low,  to get the high and low you use CopyRates()  to gain access to the history data . . .  click the link and read the sample code.
 
RaptorUK:
Ah I see . . . candle length is High - Low,  to get the high and low you use CopyRates()  to gain access to the history data . . .  click the link and read the sample code.
Many thanks, thats just what I wanted.....
Reason: