Creating an Expert Advisor

 

I just wanted to contact you guys through e-mail. I m learning MQL4 and need your help in that. I want to create an Expert Advisor which will operate my orders in every 1 minutes and 5 minutes candlesticks. But it is only working in Hourly candlesticks. It would be great if you look into my problem and help me with some codes.


Thank you,

Barnadeep

 
Barno_07:
I just wanted to contact you guys through e-mail. I m learning MQL4 and need your help in that. I want to create an Expert Advisor which will operate my orders in every 1 minutes and 5 minutes candlesticks. But it is only working in Hourly candlesticks. It would be great if you look into my problem and help me with some codes.


Thank you,

Barnadeep

https://www.mql5.com/en/job
Freelance service at MQL5.com
Freelance service at MQL5.com
  • www.mql5.com
Orders for the development of automated trading programs
 

you can store the last time of the 5m bar and check if it's not the same for the new one , then you have a new bar on the 5 min time-frame and you can put your code in this block

you can do like this in both 1M and 5M

datetime lastbar=iTime(NULL,PERIOD_M1,100);
void onTick()
{
if(iTime(NULL,PERIOD_M1,0)!=lastbar)
{
//do some thing , you have now a new bar opening and the code will run once at each opening

   lastbar=iTime(NULL,PERIOD_M1,0);
}
else
//do something else

}
Reason: