Download MetaTrader 5
To add comments, please log in or register
No time to learn MQL5? The source code library is at your service!
Rob Langley
83
Rob Langley 2013.11.06 20:54 

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
17994
Simon Gniadkowski 2013.11.06 21:38  
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 2013.11.06 22:41  
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
17994
Simon Gniadkowski 2013.11.06 22:59  
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 2013.11.07 05:58  
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