changing TP according to hours in the day

 

Hi forum, how can i change the Take Profit value for some hours during the day?

For example: time between 8:00 & 14:00, the TP is 20 pips

and time between 14:01 & 18:00 the TP is 10 pips

Please show me the way

Thanks in advanced

 
OrderModify
 

Use Date & Time functions.

if( TimeHour(TimeCurrent())>=8 && TimeHour(TimeCurrent())<=14 ){ Tp=20; }else{ Tp=10; }
 
ubzen:

Use Date & Time functions.


Thanks for the quick reply but it gave me this error :

'{' - expression on global scope not allowed C:\Program Files\WindsorDirect 4\experts\__mazz__1_1_9.mq4 (71, 30)


 
adaheem:


Thanks for the quick reply but it gave me this error :

'{' - expression on global scope not allowed C:\Program Files\WindsorDirect 4\experts\__mazz__1_1_9.mq4 (71, 30)


Sounds like an error someone would get when compiling without adding the start function or defining the Tp variable. I recommend the book and don't skip chapters.