Hi
The file you posted is an indicator. The usual cause of multiple trades is that you keep executing a new trade while the condition is present. You must either put a boolean switch on the condition so if it has been done once it gets blocked until the condition has cleared or only trade on each new candle not every tick.
Hi
The file you posted is an indicator. The usual cause of multiple trades is that you keep executing a new trade while the condition is present. You must either put a boolean switch on the condition so if it has been done once it gets blocked until the condition has cleared or only trade on each new candle not every tick.
Hi .. thx for reply ... yeah, you are right.... I ve created the EA from an indicator. I just added some OrderSends ... I figured out that it kept executing trades, because the condition was present with every new tick, so I added another condition - that it has to be 00:00 pm to execute the order, but it didnt work :) ... any other time didnt give me any trades at all and midnight didnt change the result - I still had too many trades... I will look at more EAs and try that boolean switch...
The line:
expiration = CurTime()+ PERIOD_D1;
CurTime is in SECONDS unit
Period_D1 is MINUTES unit
so you might want to do expiration = CurTime() + PERIOD_D1*60;
the way you have been doing has made all of your expirations 60 times less than what they should have been
The line:
expiration = CurTime()+ PERIOD_D1;
Thanks ... I have already corrected it today........ But that is not the main problem of the EA. It still keeps opening new trades with every tick. I need to open new trades only on new candles. Only once a day... I know its maybe a silly problem, but it is still out of my powers :)
Hi
Use this to trade once per candle.
if (timeold!=Time[0]){
timeold=Time[0];
Put condition to trade here-----------
}
Hi
Use this to trade once per candle.
if (timeold!=Time[0]){
timeold=Time[0];
Put condition to trade here-----------
}
Works great ... thats exactly, what I needed .... thx a lot ;-)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I have been trying to program my own EA. Since I have been programming only for a month or so, I cant figure out, what Im doing wrong. Its a very simple EA, which should detect a candlestick pattern "hammer" and put a pending order with 1 day expiration. It already works as an indicator and puts text and arrows above and under "hammers". The EA doesnt give me any errors, but when I try to run it, it opens hundreds of pending orders every day. I have spent 2 days trying to figure out, how to solve this, but my programming skills are just too weak. I would really appreciate, if someone could take a look at it. Its a really short EA and wont take you more than a few minutes. Thanks a lot