Hi guys,
I am using an EA to go through a few symbols in a list and also a few time frames, it worked good ,but lately i get a few errors for invalid request. I am using the CTrade library to open and manage the trades, and considering i dont work with the request struct directly i dont understand why does the error comes up. It comes up after I check that i got a successful trade. So basically the boolean that is used to check the return of the Ctrade position open, returns true, and after that the error comes.
I suppose this image will help understand.
ALso i sent the code used to open trades, hope you can help !
From the log, looks like your OrderEntry() was given an empty 'symbol'. Will be useful if you can share how you declare your "few symbols in a list", and how you iterate it and make calls to OrderEntry().
Forum on trading, automated trading systems and testing trading strategies
fxsaber, 2019.04.09 18:59
Here I immediately found two topics on this issue.
else { MqlTradeResult Result; MqlTradeRequest Request; ExtTrade.Request(Request); ExtTrade.Result(Result); Print(ToString(Request) + ToString(Result)); Print("Error on sell order on ",symbol," , code ",GetLastError()); SendMail("Order Opened !","Fail opening sell trade at "+DoubleToString(Bid)+" /SL "+DoubleToString(sl) +" /TP "+DoubleToString(tp)+" on "+symbol); }
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
fxsaber, 2018.02.28 13:39
#define TOSTRING(A) #A + " = " + (string)(A) + "\n" #define TOSTRING2(A) #A + " = " + EnumToString(A) + " (" + (string)(A) + ")\n" string ToString( const MqlTradeRequest &Request ) { return(TOSTRING2(Request.action) + TOSTRING(Request.magic) + TOSTRING(Request.order) + TOSTRING(Request.symbol) + TOSTRING(Request.volume) + TOSTRING(Request.price) + TOSTRING(Request.stoplimit) + TOSTRING(Request.sl) + TOSTRING(Request.tp) + TOSTRING(Request.deviation) + TOSTRING2(Request.type) + TOSTRING2(Request.type_filling) + TOSTRING2(Request.type_time) + TOSTRING(Request.expiration) + TOSTRING(Request.comment) + TOSTRING(Request.position) + TOSTRING(Request.position_by)); } string ToString( const MqlTradeResult &Result ) { return(TOSTRING(Result.retcode) + TOSTRING(Result.deal) + TOSTRING(Result.order) + TOSTRING(Result.volume) + TOSTRING(Result.price) + TOSTRING(Result.bid) + TOSTRING(Result.ask) + TOSTRING(Result.comment) + TOSTRING(Result.request_id) + TOSTRING(Result.retcode_external)); }
Please add 'ZeroMemory(request);' after 'MqlTradeRequest' . It was fix error for me
Worked for me too, thank you!

- 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 using an EA to go through a few symbols in a list and also a few time frames, it worked good ,but lately i get a few errors for invalid request. I am using the CTrade library to open and manage the trades, and considering i dont work with the request struct directly i dont understand why does the error comes up. It comes up after I check that i got a successful trade. So basically the boolean that is used to check the return of the Ctrade position open, returns true, and after that the error comes.
I suppose this image will help understand.
ALso i sent the code used to open trades, hope you can help !