How to prevent more than one order per signal
1 replies
RJL
10 years ago #114498
Hello Support / SQ Forum,
Please can you tell me what condition I can have in place to prevent a second order being placed after the original order has been opened and closed on the same bar?
Example:
IF conditions are met, so trade gets executed.
The trade reaches its target and is then closed…
…however it gets closed on the same bar it was opened, so the signal is still valid, so the EA opens a brand new trade.
But I don’t want a second trade to be opened on the same bar, because price would have moved away from its optimum entry.
I’ve already tried the rule ‘&& (sqGetBarsSinceExit(MagicNumber) > 0)’ but it doesn’t seem to work properly as it simply doesn’t allow any trades being opened at all.
I run the EA on multiple pairs and same time frame in the same instance of MT4.
Is there another way I can do this that works?
Since adding the ‘&& (sqGetBarsSinceExit(MagicNumber) > 0)’ rule, it doesn’t open any trades. (It missed many signals today)
However, without it, it opens too many trades…and aside from the first trade on that one signal, they are away from optimum entry.
Thanks.
0
RJL
10 years ago #134317
No worries…
I think I found it:
&& (sqOrderOpenedThisBar(MagicNumber) == false
0
Viewing 1 replies (of 1 total)