why this code isn't working?
- Nothing wrong with the code you posted. Oops, I missed the missing equals.
if (OrdersTotal () != 0){
Unnecessary. If it's zero the for loop does nothing.buy_order_exists = 1;Don't use int and zero/one when you mean bool and true/false.- no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
for (int i = OrdersTotal()-1; i > 0; i--)
change to
for (int i = OrdersTotal()-1; i >= 0; i--)
I want to check if total orders are not zero, then,
if buy order exists, I want to set the variable "buy_order_exists" to "1"
if sell order exists, I want to set the variable "sell_order_exists" to "1"
But my code doesn't update the variables when the orders are exist.