Your loop is very complicated (besides some other variable naming issues). You have tradinglots as a parameter but use *lots* as a (global) variable.
Also not tested, this is might be more straightforwarded:
void martket_order_loop(int tradingtype,double tradinglots,string tradingcmts) { bool done=false; do { double tradelots=maxlots; if(tradinglots<=maxlots) { tradelots=tradinglots; done=true; } tradinglots-=tradelots; if(tradingtype==0) { ticket_buy_1=OrderSend(Symbol(),OP_BUY,tradelots,Ask,3,0,0,tradingcmts,magicno,0,Blue); } } while(!done); }

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
Due to my trading account is cent one, the max trading volume is 100lots.
If my trading lot is over 100, then EA need to separate into few orders.
I am trying to write a do-while statement, but it seems I could not get correct spare trading lots.
Please refer my codes below, and kindly give me some feedback,
Thank you so much.