Download MetaTrader 5

How to get PERIOD's (high/low/close/open) values?

To add comments, please log in or register
Do you need OpenCL? MQL5 can provide it!
tazosmr
64
tazosmr 2015.10.29 20:17 

On 15 minute (or 10 min)  chart,  how to plot the WEEKLY (OR 4HR  OR DAILY or whatever timeframe i choose)   HIGH / LOW lines?

(this code onle detects DAILY lines - http://pastebin.com/raw.php?i=QFgWLcmU )

tazosmr
64
tazosmr 2015.11.02 10:54  

the only way I have found so far (TO Detect when NEW period Starts : High/low prices of that chosen timeframe):

http://pastebin.com/raw.php?i=23sx6KEK

Mohammad Soubra
24861
Mohammad Soubra 2015.11.02 20:57  

try to use:

close[0]

high[0]

low[0]

or

....

open[0]

 

 

u can replace the zero by the candle shift

 

this enough answer???? 

Siti Latifah
6447
Siti Latifah 2015.11.03 09:16  
Mohammad Soubra:

try to use:

close[0]

high[0]

low[0]

or

....

open[0]

 

 

u can replace the zero by the candle shift

 

this enough answer???? 

int TF=10080; //weekly or 1440(daily)

double HighWeek=iHigh(Symbol(),TF,0);
double LowWeek=iLow(Symbol(),TF,0);
Marco vd Heijden
Moderator
4685
Marco vd Heijden 2015.11.03 18:43  

can also use direct ENUM_TIMEFRAMES

int TF=PERIOD_D1; //weekly or 1440(daily)

double HighWeek=iHigh(Symbol(),TF,0);
double LowWeek=iLow(Symbol(),TF,0);

or switchable on chart.

int TF=PERIOD_CURRENT; //weekly or 1440(daily)

double HighWeek=iHigh(Symbol(),TF,0);
double LowWeek=iLow(Symbol(),TF,0);

but can be combined there is no need to declare int TF.

double HighWeek=iHigh(Symbol(),PERIOD_CURRENT,0);
double LowWeek=iLow(Symbol(),PERIOD_CURRENT,0);
To add comments, please log in or register