Please declare and initialize the trade request.
//--- declare and initialize the trade request and result of trade request MqlTradeRequest request={0}; MqlTradeResult result={0};
Marco vd Heijden:
ZeroMemory() won't do that ?Please declare and initialize the trade request.
the strange thing is, I don't always get this error, just sometimes.
this code is executed on click event, even when the SL and TP objects lines are NOT moved, I get thetrade done successfully, and sometimes it gets the 10021 error.
I think it's safe to assume it's a server issue , right ?

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
this is a snippet, executed on ChartEvent click event :
on some clicks on the object, it prints 10021, sometimes it opens the trade without problem.
the TP and SL HLINE objects, are verified to be valid, before this snippet is executed.
(they are out of symbol freeze range, and are OK to be used as stop prices. because on some clicks, they open the desired trade.)
what causes a server to return 10021 error code ?