//-------------------------- Closing Orders ------------------------------------------ while(true) // Loop of closing orders { if (Ind_OsMA == 1) // Order Buy is opened.. { // and there is criterion to close RefreshRates(); // Refresh rates Ans=OrderClose(MagicNum,Lot,Bid,2); // Closing Buy if (Ans==true) // Success :) { break; // Exit closing loop } if (Fun_Error(GetLastError())==1) // Processing errors continue; // Retrying return; // Exit start() }
@Ickyrus - Thanks for that find!
However, my back testing still isn't working right. It still stalls after collecting the data. I have changed up my EA a little bit so I have uploaded the updated EA below.
Edit: The back testing journal said I had two error: 1. symbol name for MarketInfo function must be a string 2. zero divide (that's all it said)
I believe I have fixed the first error. I am guessing the second error is saying I tried to divide by a zero so you would get undefined but I can't find anywhere in my EA would I do divide by zero. Any ideas would be much appreciated.
Arrays start from 0
for (int i = 1; i >= OrdersTotal(); i++){ // Loop through orders
should be
for (int i = 0; i >= OrdersTotal()-1; i++){ // Loop through orders
but better to go backwards through the orders array with
for (int i = OrdersTotal()-1; i>=0 ; i--){ // Loop through orders
So if you are hoping to process you first order it would never be selected when starting from 1.
Next spot
Total++; // Counter of market orders if (Total < 1) { // No more than one order Alert("Several market orders. EA doesnt work."); return; // Exit start() }The EA starts with no orders so Total less than one will be true when the EA starts - thats enough for you (and me!) to work on for now

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I have been trying to teach my to program an expert adviser for about a week. I have been following the EA template in the book for order accounting, closing orders, and opening orders but implementing my own strategies. However, whenever I try to back test it stops right after it collects all of the data and the journal says " CloseOrder error 4063.... ticket must be an integer." I don't get why I am getting that error even though I have assigned a variable ticket as an integer. I have attached the file, so please take a look at it and tell me what you think the problem might be.
Also, if you find anything else that could be a bug or could just give me any advise how to things better I would really appreciate it!
Thank you so much for taking the time to look at my file!