I'm not sure whether this has been covered before but what exactly does IsTradeAllowed do? What trade operations does it check ?
I think alot of people have multiple experts running and experiencing trading collisions so some help/guidance and perhaps example code using what you think is a good starting point might prove useful to many people complaining about this subject.
Cheers
Martin
I think alot of people have multiple experts running and experiencing trading collisions so some help/guidance and perhaps example code using what you think is a good starting point might prove useful to many people complaining about this subject.
Cheers
Martin
IsTradeAllowed checks for Allow Live Trading flag in the expert properties and check whether another expert occupies trade thread (experts process trade operations in the special thread that is only one for all experts)
Here's an example of how I think it should be used:
DELETED BY AUTHOR BECAUSE IT DIDN'T WORK AS INTENDED. SEE THE CORRECTED VERSION IN THE RESPONSE BELOW.
- Vooch
I was talking with Mage and noticed I was still getting TradeDispatch errors, so we talked a bit and he suggested I Sleep() for a bit, so here's an example of what I'm doing.
while(IsTradeAllowed()==False) { Sleep(100); Print("Sleeping for 100 milliseconds"); } if(IsTradeAllowed()==True) { ticket=OrderSend(Symbol(),OP_BUY,order_lots,order_open,3,order_stoploss,order_takeprofit,ScriptName,MagicNumber,0,Lime); if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) { // success } else { Print("ERROR:",GetLastError()," OP_BUY Close[0]=",Close[0]," OO=",order_open," SL=",order_stoploss," TP=",order_takeprofit," lots=",lots," Bid=",Bid," Ask=",Ask); } } else { Print("Programming Logic Error. I should never reach this point."); }
This script will also alert me if I'm still having problems.
- Vooch
ok. we'll attempt to reproduce your problem.
how much experts work together at the same time?
how much experts work together at the same time?
> how much experts work together at the same time?
I've got 25 experts running at the same time. Each one might send 1-10 orders through fairly quickly.
When testing it, I got a code #133 ERR_TRADE_DISABLED.
- Vooch
I've got 25 experts running at the same time. Each one might send 1-10 orders through fairly quickly.
When testing it, I got a code #133 ERR_TRADE_DISABLED.
- Vooch
> how much experts work together at the same time?
I've got 25 experts running at the same time. Each one might send 1-10 orders through fairly quickly.
When testing it, I got a code #133 ERR_TRADE_DISABLED.
I've got 25 experts running at the same time. Each one might send 1-10 orders through fairly quickly.
When testing it, I got a code #133 ERR_TRADE_DISABLED.
mamma mia.
10 experts ask "is trade allowed?", 10 experts receive answer "yes of course", 10 experts send order but first expert only trade successfully. other 9 experts are losers and outsiders

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
I get this error in my Journal.
I do not know what this error means precisely. Obviously there is some sort of bottleneck, but what I am wondering is...Am I causing this error to occur by sending too many orders at once, Or is this an error that is completely out of my control???
Basically I need to know if I'm doing something wrong and what I need to do to prevent it in the future.
Thank you for your help,
Tony