Hi
What do you mean by "sleep"? It should work but don't trade or it shouldn't run at all? It may check time when starts and if the "sleep" time has not passed yet just return without doing anything.
wookeyI mean the sleep () command/function or other function to stop trading (but still running) for example for 5 minutes after stop loss trade.
aleks
Hi guys, I am working on promising EA, the problem is it required sleep function after loss trade and I dont know how to implement this. Any chance you can help with this.
Thanks
Aleksint MinutesToNextTrade = 5;
int orders=HistoryTotal();
OrderSelect(orders-1,SELECT_BY_POS,MODE_HISTORY);
if (OrderProfit()<0 && CurTime()-OrderOpenTime()<MinutesToNextTrade) return(0);
Try this... maybe it works...
Raff
int MinutesToNextTrade = 5;
int orders=HistoryTotal();
OrderSelect(orders-1,SELECT_BY_POS,MODE_HISTORY);
if (OrderProfit()<0 && CurTime()-OrderOpenTime()<MinutesToNextTrade) return(0);
Try this... maybe it works...
RaffHi RAff
Thanks for your help, but I cant get it to work, I try to past this in expert start function part of code, I also try to put this in Signal End part but still no effects. Can you tell me where I should place this code, I mean in which part of the EA code - sorry I'm really bad with programing
aleks
Hi RAff
Thanks for your help, but I cant get it to work, I try to past this in expert start function part of code, I also try to put this in Signal End part but still no effects. Can you tell me where I should place this code, I mean in which part of the EA code - sorry I'm really bad with programing
aleksint MinutesToNextTrade = 5;
int orders=HistoryTotal();
OrderSelect(orders-1,SELECT_BY_POS,MODE_HISTORY);
if (OrderProfit()<0 && CurTime()-OrderOpenTime()<MinutesToNextTrade*60) return(0);
Hi, it should be placed at the beggining of "start" function...
Also there should be " *60 "... Sorry, my mistake...
Raff
Hi RAff
Thanks for all your help. Unfortunately I can get this code to work, maybe I am doing something wrong, the truth is that this is my first EA and I don’t have much experience with this sort of programming. The problem with this ea is very minor, from time to time it opens trades one after another in wrong direction, please see statement so you can understand what I am talking about. Apart of this it is really good especially as my first EA. I attached the code so maybe you can have a suggestion how I can solve my little problem.
regards
aleks
Hi elihayun
I know the back test sucks but it is the only way to quickly optimize EA which I know. I do not really trust in this sort of testing in 100% but its the only way to find the weaknesses of EA in a short time.
In regards 10pips in one minute trade that's real when you have 2pips spread and the market is going strongly. As you can see from this statement very often the trade is close with 1,2 or 0 pips, the indicator is very sensitive (maybe too sensitive) and as you know even in strong trend you get weak moments and that's way you getting some 10pips trades closed in less than one minute.
Thanks for the code, could you please explain the purpose of it, how its working etc. I would like to learn little bit more about it so I dont have to ask you the same question again in future.
regards
aleks
- 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 guys, I am working on promising EA, the problem is it required sleep function after loss trade and I dont know how to implement this. Any chance you can help with this.
Thanks
Aleks