Expert Advisor MT4

 

Good morning everyone,

I wrote an expert Advisor in mql4 format which open position at certain time of the day, it calculate number of lots, take profit and stop loss.

Now I want to change it because it doesn’t work very well and I want that it open position when the candle start (in the timeframe I set) but I don’t know the function to write it. Can someone please help me? 

 
Here you'll find a list of all functions of MQL4. Just search there with Ctrl-F and "iTime"
 
Carl Schreiber:
Here you'll find a list of all functions of MQL4. Just search there with Ctrl-F and "iTime"
I searched “iTime” but there is no result. 
 
datetime Update_Time;

void OnTick()
{

   if(Update_Time != iTime(NULL,0,0)) { 
      Update_Time = iTime(NULL,0,0);
   
      ... //your code

   }

}
 
Roman Starostin:

Thank you, but this function is for open position at a certain time of the day. I want to open position when the candlestick start. For example, I set the timeframe M5, every 5 minutes (when the candle starts) it opens my position. 

 

If you use M5 TF - this sode will be work 1 time per 5 minutes when new candle is appeared. Try it.