
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Yes :):)
so many posts to you and to MLADEN regarding this matter here along with request and idea section thread,really i got a lot of time from both of you and i am really sorry for that,looks like i am more dull to make explain my issue.
and i think we are going to add time control today,let me search out the snippet first :)
regards
mntiwana
Code for time filter you can find here : https://www.mql5.com/en/forum/184052
mntiwana
Code for time filter you can find here : https://www.mql5.com/en/forum/184052
Dearest MLADEN
Thanks for pointing me time control snippet,got it and i am trying to adjust it as per my level :)
and of course lately it needs corrections,the only thing i can perform,in-stabilized the code :)
is it usable for mt4 too ? .... because it is mentioned like mt5.
//| _test.mq5 |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
regards
Dearest MLADEN
Thanks for pointing me time control snippet,got it and i am trying to adjust it as per my level :)
and of course lately it needs corrections,the only thing i can perform,in-stabilized the code :)
is it usable for mt4 too ? .... because it is mentioned like mt5.
//| _test.mq5 |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
regards
Does not matter : just copy this part :
bool checkTimeLimits(uint startHour, uint startMinute, uint endHour, uint endMinute, datetime timeToCheck) { return(checkTimeLimits(startHour,startMinute,0,endHour,endMinute,0,timeToCheck)); }
bool checkTimeLimits(uint startHour, uint startMinute, uint startSecond, uint endHour, uint endMinute, uint endSecond, datetime timeToCheck)
{
bool answer = false;
MqlDateTime tempTime; TimeToStruct(timeToCheck,tempTime);
datetime startTime,endTime,checkTime;
startTime = _ctMinMax(startHour,0,24) *3600+_ctMinMax(startMinute,0,60) *60+_ctMinMax(startSecond,0,60);
endTime = _ctMinMax(endHour,0,24) *3600+_ctMinMax(endMinute,0,60) *60+_ctMinMax(endSecond,0,60);
checkTime = _ctMinMax(tempTime.hour,0,24)*3600+_ctMinMax(tempTime.min,0,60)*60+_ctMinMax(tempTime.sec,0,60);
if (startTime>endTime)
answer = (checkTime>=startTime || checkTime<=endTime);
else answer = (checkTime>=startTime && checkTime<=endTime);
return(answer);
}
uint _ctMinMax(uint value, uint min, uint max) { return((uint)MathMax(MathMin(value,max),min)); }
to the EA and see in that example how it is used - it will work the same in metatrader 4 as well as in metatrader 5
Does not matter : just copy this part :
bool checkTimeLimits(uint startHour, uint startMinute, uint endHour, uint endMinute, datetime timeToCheck) { return(checkTimeLimits(startHour,startMinute,0,endHour,endMinute,0,timeToCheck)); }
bool checkTimeLimits(uint startHour, uint startMinute, uint startSecond, uint endHour, uint endMinute, uint endSecond, datetime timeToCheck)
{
bool answer = false;
MqlDateTime tempTime; TimeToStruct(timeToCheck,tempTime);
datetime startTime,endTime,checkTime;
startTime = _ctMinMax(startHour,0,24) *3600+_ctMinMax(startMinute,0,60) *60+_ctMinMax(startSecond,0,60);
endTime = _ctMinMax(endHour,0,24) *3600+_ctMinMax(endMinute,0,60) *60+_ctMinMax(endSecond,0,60);
checkTime = _ctMinMax(tempTime.hour,0,24)*3600+_ctMinMax(tempTime.min,0,60)*60+_ctMinMax(tempTime.sec,0,60);
if (startTime>endTime)
answer = (checkTime>=startTime || checkTime<=endTime);
else answer = (checkTime>=startTime && checkTime<=endTime);
return(answer);
}
uint _ctMinMax(uint value, uint min, uint max) { return((uint)MathMax(MathMin(value,max),min)); }
to the EA and see in that example how it is used - it will work the same in metatrader 4 as well as in metatrader 5
Dearest MLADEN
Thanks for guidance,i copied this and upper part (from the snippet) in the EA code and did not added the middle part .... (this one)
is it right ?
{
return(0);
}
//
//
//
//
//
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
//
//
//
//
//
Comment(checkTimeLimits(StartHour,StartMinute,StartSecond,EndHour,EndMinute,EndSecond,TimeCurrent()));
return(rates_total);
}
Dearest MLADEN
Thanks for guidance,i copied this and upper part (from the snippet) in the EA code and did not added the middle part .... (this one)
is it right ?
{
return(0);
}
//
//
//
//
//
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
//
//
//
//
//
Comment(checkTimeLimits(StartHour,StartMinute,StartSecond,EndHour,EndMinute,EndSecond,TimeCurrent()));
return(rates_total);
}
Try this
Try this
Dearest MLADEN
Just now market is open here at my place and i tested time control feature,it is working well :)
so kind of you and big appreciations.
is there any snippet or code that turn this EA to 3 optional states trading capable.
open order at 1= every first tick ... 2= at every new bar ... 3= at every new trend
with true/false option and at one time only one option will be true.
suppose we are in up trend with buy order and this buy order is closed due to any reason TP/SL , manually or by accident then EA should test conditions and open a order accordingly at first tick or at first new bar or when trend change to sell side by closing previous and open new opposite to previous ..... for now EA is opening trades at trend change only.
regards
Try this
Thanks for this very good ea.
Dear @mladen,
Can you add "dynamic take profit and SL" features this ea?
Dearest MLADEN
Just now market is open here at my place and i tested time control feature,it is working well :)
so kind of you and big appreciations.
is there any snippet or code that turn this EA to 3 optional states trading capable.
open order at 1= every first tick ... 2= at every new bar ... 3= at every new trend
with true/false option and at one time only one option will be true.
suppose we are in up trend with buy order and this buy order is closed due to any reason TP/SL , manually or by accident then EA should test conditions and open a order accordingly at first tick or at first new bar or when trend change to sell side by closing previous and open new opposite to previous ..... for now EA is opening trades at trend change only.
regards
There is no general code snippet for that (since the new trend is always specific for the ea conditions)
The first two can be made, but that must be incorporated in the rest of the code too (for cases when the order has to be modified, we can not just skip the rest of the EA processing on the beginning of start() or OnTick())
Thanks for this very good ea.
Dear @mladen,
Can you add "dynamic take profit and SL" features this ea?
oguz
We are trying to make it a complete and full figured EA and adding all possible and mostly required features in it step by step and it is just at its early stage and simple,any way you can use simple TP/SL feature that is already working with it.
regards
There is no general code snippet for that (since the new trend is always specific for the ea conditions)
The first two can be made, but that must be incorporated in the rest of the code too (for cases when the order has to be modified, we can not just skip the rest of the EA processing on the beginning of start() or OnTick())
Dearest MLADEN
Thanks for explained response,just i want to make it usable for every and any user in any market situation according to ones requirement,possibly long term,medium term even for short term scalpers too,so i requested for that (every tick/every new bar and every new trend) option ..... i know that is some kind big coding process,i also know your busy days,so i can wait when ever you can manage, step by step help guidance us ..... may be some other kind coder willing to assist me in this regard and lately you correct where needed but i don't see any one else at the moment :)
actually my extreme wish to have a complete/perfect diagram/frame for EA/s,so that users can use it for future EA/s formation,though different requirements,situations and indicators needs different coding process.there are some old frames but those are not valid code for today/new MT4 compatible,aside from other users i extremely needs it :):)
regards