DeanDeV: Any way to stop it from placing 2, sometimes 3, on a single crossover?
if(direction==0)
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- Look for open orders and which bar the order was opened on. Or don't look for a signal, look for a change in signal:
static int direction = -1; int dirPrev = direction; direction = ...; if(dirPrev != direction) OrderEntry(direction);
- Don't use int 0 and 1 when you mean bool. Don't use int 0 and 1 when you mean OP_BUY and OP_SELL.
- Check your return codes (OrderSend and OrderModify) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
if(buyticket>0)OrderModify(buyticket,OrderOpenPrice(),MABSL,MABTP,0,CLR_NONE);
You can not use any Trade Functions - MQL4 Documentation unless you select the order first.
I used this:
int ThisBarTrade = 0; if (Bars != ThisBarTrade ) { ThisBarTrade = Bars; }Seems to be working perfectly now. Thanks!

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
Hi,
I have a MA EA which should only place a single buy/sell order on a cross over. Any way to stop it from placing 2, sometimes 3, on a single crossover?