EA Automatic Turn On / Off

 

Hello All,

I'm fairly new to all of this, so I was wondering if there's a way I can add time inputs so that I can leave automatic trading turned on, but the EA will only place trades during certain hours (i.e. between 3 AM and 7 AM).


Not sure if it matters, but I'm using MT4 and MQL4.


Thank you in advance!

 

Please don't double post. I've removed your other thread.

 
tgraffa: I was wondering if there's a way ... EA will only place trades during certain hours (i.e. between 3 AM and 7 AM).
  1. Only if you can code it that way.
    #define HR0300 (3*3600)
    #define HR0700 (7*3600)
    SECONDS tod = time( TimeCurrent() );
    if(tod < HR0300 || tod >= HR0700) return;
              Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum

  2. Don't double post!
              General rules and best pratices of the Forum. - General - MQL5 programming forum
 


Didn’t know which forum my question belonged in and didn't see the rules... sorry!!

Thank you for the helpful hints, I will try it out :) 
Reason: