Forum

Limit trading to given hours and days

Hello I'd be very grateful if someone could confirm that I have my logic correct here: // only trade Monday to Friday inclusive if (DayOfWeek()== 0 || DayOfWeek()== 6 ) return ; // don't trade during the hours of 0, 4, 18 to 19 inclusive, 22 to 23 inclusive if ((Hour()>= 0 && Hour()< 1 ) ||

Do this once a day

Hello I'm trying to do something simple, but it is eluding me due a toxic mix of a lack of knowledge and stupidity. With this piece of code, I'd like to print to the log a simple message, once a day, near the start of the day: bool printed= true ; { if (Hour() > 0 ) printed= false ; if (Hour()== 0

How to extract hh:mm time from time value?

I'd be very grateful for a little help. I'm trying to extract the hours:minutes close time of the previous bar. Looking at the help here https://docs.mql4.com/convert/timetostring , I think I need something like this: HrsMinsTime TimeToString ( datetime LastMarketCloseTime, int

Large M1 data disappears from MT4 between re-launches, but .hst files all present

I wonder if anyone else has come across this. Is it a bug? I'm able to import _SP500.csv which contains 30 years' worth of minute data successfully through History Center (for the method followed see https://forum.mql4.com/51224), and create all my .hst files for the market. I'm then able to run

Excel filename sequence

Hello Apologies for another really dumb question, but its beyond me! In my EA, I'm collecting and writing data into weekly Excel spreadsheets, which I'm incrementally numbering, creating one new sheet per week. This is fine, but I end up with spreadsheets all named as numbers only. I'd like to use

Historic data import F2

I'd be most grateful if someone could an answer to a question which is eluding me. I have two sets of historic data from separate sources for the same currency pair . As we all know, all data sets have gaps. If I import first one then the other will I have fewer gaps, or will the import of the

Find current order to stop distance for all open trades in my EA

I'm sure this has probably been asked and answered before, but I don't seem to be able to find an answer. If someone could point me in the right direction I'd be most grateful. I'm trying to have my EA check the distances between all (up to 5) opening trade levels and current trailing stops for

Can't work out why this isn't working

Hello I'd be very grateful for a little assistance. I can't work out why this little bit of script doesn't work: double v1=AccountFreeMargin()*(RPC/ 100 ); double v2=ABC*AccountLeverage(); double v3=(v1/v2); Where: RPC = 1 ABC=20 I'm sure its something simple that I just haven't been able to find

Tester: exchange rate cannot be calculated

I'm using MT4 build 451 together with Tick Data Suite Loader to do back testing. I'm consistently getting the following error message in journal, although the EA seems to run: "Tester: exchange rate cannot be calculated" I've read elsewhere that this occurs if you don't use the correct currency on