hello guys. can anyone help me with this. im trying to add a code that will 1.) close all order when one order is close. 2.) open order on the price the first order was open.
To close all orders, you'll have to cycle through all orders and close the ticket#. If order close succeed, you'll get a true value otherwise you'll get an error message. You'll want to save the OrderOpenPrice() of the first order prior to closing || you'll want to loop through history and get the OrderOpenPrice(). When OrdersTotal()==0 || CustomOrderTotal()==0 then place the new order.
De-bugging your code takes hours and thats how you'll learn, sorry, I have hours of my own codes to de-bug.
For example on CloseAllOrders: https://www.mql5.com/en/code/7607.
For de-bugging tips look here: What are Function Return.