Simple Expert Advisor from Book question
I believe the if statement should be Total > 1, each market order would increment total by 1, so, if total was greater than 1 then there would be several market orders, also, total is initialized at 0 before the for loop, and then incremented right before the if statement, so total < 1 would never execute anyways. But I am completely new to all this, so I could just be blinded by silly-stupidness.
The for-condition "for(int i=1; i>=OrdersTotal(); i++)" also looks wrong. It's only going to execute properly if there's only one order (though it will try and fail to execute if there are no orders). That's presumably why the bug you've identified wasn't picked up; the code was never actually tested with multiple orders.
I think you're right.
The for-condition "for(int i=1; i>=OrdersTotal(); i++)" also looks wrong. It's only going to execute if there's only one order. That's presumably why the bug you've identified wasn't picked up; the code was never actually tested with multiple orders.
Hi,
I am new to MQL and looking through the book and I was looking at the code in the example for a simple expert advisor (https://book.mql4.com/samples/expert) in the 4th block
}
I believe the if statement should be Total > 1, each market order would increment total by 1, so, if total was greater than 1 then there would be several market orders, also, total is initialized at 0 before the for loop, and then incremented right before the if statement, so total < 1 would never execute anyways. But I am completely new to all this, so I could just be blinded by silly-stupidness.
Thanks for your time,
Amit Sharma