Cnsnmms: didn't produce any error code...
OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage,SellStopLossLevel, SellTakeProfitLevel); closed=OrderClose( OrderTicket(), OrderLots(), Ask,0, White);
- No error code because you don't check for them.
- Check your return codes and find out why. 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
- In the presence of multiple orders (one EA multiple charts, multiple EA's, manual trading)
you must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
Thanks for comment. I solved it and you are right about the error code problem :) sorry

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'm trying to write a simple rsi EA code for mt4 but my code is working just part time . ClosePosition function is not working.( probably my code is a bit weirdo lol ) . It worked without a problem few times but mostly didn't work on the same computer and also didn't produce any error code... I'm trying to solve the problem since 3 hours. Anyone can explain me the overall problem also where I exactly put the ClosePosition function in the code ?