can someone help me....
Explain what you mean by "help" in this case? How do you see that playing out?
CB
Explain what you mean by "help" in this case? How do you see that playing out?
CB
I just start to learn mql 4 language and have no I idea where to start to build such a code.For example which standart function should be used to point the so called referarance point of time I mentioned ?
I just start to learn mql 4 language and have no I idea where to start to build such a code.For example which standart function should be used to point the so called referarance point of time I mentioned ?
A quick search of the documentation will reward your effort (see what I'm saying here?) with this:
https://docs.mql4.com/dateandtime
CB
Hi,
I'm trying to build an expert which will enter/exit the market based on timing.What I mean is,for example if first trade is at 2009.08.20 23:00, a new position should be opened 3 hour later if the first one is closed either by t.p or s/l order.İf position is still open, next entry time should move 3 hours ahead.(in this case at 2009.08.21 02:00, 05:00 ...etc.)First trade of this serie (2009.08.20 23:00) is considered as a referance point and weekends should be discarded when calculating new entry time.(if first trade is friday at 23:00, next one should be at monday 02:00 (three hours later).
Is it hard to code such a function,can someone help me....
thanks in advance...
Well, first of all try to think nothing is really hard to code, it just take more time sometimes :-)
In the case you're exposing, you can manage the sequence of time dealing with the bars on H1 time frame so you won't have to bother with the weekend. But if you prefer to deal with real time then it's also possible, see the code below as an example.
The only think I don't really see is how to determine an order is the first of a serie (first trade of the day, of the week, you entered manually...?) ? but I'm sure you have the answer.
Hope it helps.
Cheers
//------------------------------------------------------------------------------- // MoreThanMinutes() Returns true if wTime > wTime + elapseMax(in minutes) // (extract the weekend closing time) // // ELAPSEMAX SHOULD NOT EXCEED 48H (2880 MINUTES) //------------------------------------------------------------------------------- bool MoreThanMinutes(datetime wTime, int elapseMax) {int elapse, minutesCT, minutesOOT,hoursCT,hoursOOT,dayCT,dayOOT; minutesCT = TimeMinute(TimeCurrent()); minutesOOT = TimeMinute(wTime); hoursCT = TimeHour(TimeCurrent()); hoursOOT = TimeHour(wTime); dayCT = TimeDay(TimeCurrent()); dayOOT = TimeDay(wTime); elapse = (minutesCT-minutesOOT)+(hoursCT-hoursOOT)*60+(dayCT-dayOOT)*60*24; if (elapse > 49*60) // weekend close of 49 hours (that is why OrderLasting is limited to 48 hours) {elapse = elapse - 49*60; } if (DebugMode) {Print ("----------------------------------- elapse : ",elapse);} if (DebugMode) {Print ("-------------------------------- elapseMax : ",elapseMax);} if (elapse >= elapseMax) return(true); else return(false); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm trying to build an expert which will enter/exit the market based on timing.What I mean is,for example if first trade is at 2009.08.20 23:00, a new position should be opened 3 hour later if the first one is closed either by t.p or s/l order.İf position is still open, next entry time should move 3 hours ahead.(in this case at 2009.08.21 02:00, 05:00 ...etc.)First trade of this serie (2009.08.20 23:00) is considered as a referance point and weekends should be discarded when calculating new entry time.(if first trade is friday at 23:00, next one should be at monday 02:00 (three hours later).
Is it hard to code such a function,can someone help me....
thanks in advance...