Download MetaTrader 5

Newbie Question: Candlestick Properties

To add comments, please log in or register
Rob Langley
83
Rob Langley  

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
Simon Gniadkowski
Moderator
18021
Simon Gniadkowski  
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 ?
Rob Langley
83
Rob Langley  
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 

Simon Gniadkowski
Moderator
18021
Simon Gniadkowski  
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.
Rob Langley
83
Rob Langley  
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.....
To add comments, please log in or register