I install'd time filter in the very beginning of the EA and it works fine,open trade only in trading hours, problem is EA will not manage open trade outside time filter.
TrailingStop will not work. i believe the EA at all stop working outside time filter.
How do i create time filter to open trade (EA does it already) but keep on managing open trade outside time?
Please point me in the right way!
Thanks alot
sorry about my Denglish
Denglish=(Deutsch+English)
<CODE DELETED>
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
Rest of Code is not executed if . . .
return(TradeHour);
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
Rest of Code is not executed if . . .
extern bool TradeOnFriday =true; //trade on friday extern int FridayStartHour =9; //start hour time filter on friday extern int FridayEndHour =12; //end hour time filter on friday void start() { //+------------------------------------------------------------------+ //| Day&Time Filter | //+------------------------------------------------------------------+ bool TradeHour; if( (TradeOnFriday==false&&DayOfWeek()==5)|| (TradeOnFriday&&DayOfWeek()==5&&!Hour()>=FridayStartHour)|| (TradeOnFriday&&DayOfWeek()==5&&!Hour()<=FridayEndHour-1) ) return(TradeHour); //+------------------------------------------------------------------+ //| Rest of Code | //+------------------------------------------------------------------+
If you want your "time filter" to apply just to opening trades then check it before you place a trade and if it applies don't place the trade.
Please edit your first post.
So what you saying is the TF is in the wrong place in the EA.
Thanks for the quick respond.
So what you saying is the TF is in the wrong place in the EA.
Thanks for the quick respond.
Wrong place or just poorly implemented.
Please edit your first post
Wrong place or just poorly implemented.
Please edit your first post
Please edit your first post (Hope thats rightnow)
Wrong place and poorly implemented.
To implemented right is there a place (in this forum) i can read about it .
I do believe somone had a simular problem before me.
i do not want to ask somone to writte it for me, thats not the way of learning, i like to find out on my own.
Please do give me derection.
Thanks again for the fast response
Please edit your first post (Hope thats rightnow)
Wrong place and poorly implemented.
To implemented right is there a place (in this forum) i can read about it .
I do believe somone had a simular problem before me.
i do not want to ask somone to writte it for me, thats not the way of learning, i like to find out on my own.
Thank you for editing your post.
A simple quick modification would be to set a bool variable to true or false depending on the result of the filter instead of using return, then check this bool before placing a new trade . . . for example . . .
bool TimeFilterAllowTrading; // your time filter . . . TimeFilterAllowTrading = false; // instead of return else TimeFilterAllowTrading = true; // later in your code where you place trades . . . if(TimeFilterAllowTrading) Ordersend(. . . . );
Thank you for editing your post.
A simple quick modification would be to set a bool variable to true or false depending on the result of the filter instead of using return, then check this bool before placing a new trade .
Thank you for editing your post.
A simple quick modification would be to set a bool variable to true or false depending on the result of the filter instead of using return, then check this bool before placing a new trade . . . for example . . .
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I install'd time filter in the very beginning of the EA and it works fine,open trade only in trading hours, problem is EA will not manage open trade outside time filter.
TrailingStop will not work. i believe the EA at all stop working outside time filter.
How do i create time filter to open trade (EA does it already) but keep on managing open trade outside time?
Please point me in the right way!
Thanks alot
sorry about my Denglish
Denglish=(Deutsch+English)