Download MetaTrader 5
To add comments, please log in or register
MQL5 Cloud Network speeds up calculations. Try it!
foldeks
12
foldeks 2014.07.04 14:40 

Dear Friends,

 Please, who can help me with my problem?

EURUSD Weekly

 

EURUSD Daily 

 Line is placed by script, so, I want to check date existence and place it exactly on week start. Or, I it will be nice to have any solution to achieve result. 

 

Regards, 

Alain Verleyen
Moderator
29594
Alain Verleyen 2014.07.04 15:55  

Hi,

If your line is placed by script, what's your problem exactly ? When you place a line it's up to you to choose where to place it.

Please show the relevant code.

foldeks
12
foldeks 2014.07.05 06:59  

The code is:

 

datetime dt_tm1 = 0, dt_buff[1] = {0};   

CopyTime( _Symbol, PERIOD_W1, 0, 1, dt_buff );

dt_tm1 = dt_buff[0];


Then I use dt_tm1 as time parameter to create line. 

Alain Verleyen
Moderator
29594
Alain Verleyen 2014.07.05 11:51  

Forum on trading, automated trading systems and testing trading strategies


Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

I see now. The first day of a week is always Sunday, see documentation :

Thus, if the current day is Saturday, at the attempt to copy data on a week timeframe specifying start_time=Last_Tuesday and stop_time=Last_Friday the function will return 0, because the open time on a week timeframe is always Sunday, but one week bar does not fall into the specified interval.

foldeks
12
foldeks 2014.07.05 17:39  

angevoyageur,

Sorry, my mistake -- I will use SRC for code! :)

I understood and will check the documentation. Thank you for help!

Regards, 

/
To add comments, please log in or register