Woodyz wrote: Sat Nov 05, 2022 2:27 pm
A quick & probably dumb question to clarify the use of Xards Buy, Sell, Close Scripts before next week's trading.................
Open a trade ............. I.e., "alt B or S" A Buy or Sell trade is opened using the lots set in the MT4 platform?
The Chicken Script closes all opened trades for the pair or closes all pairs with open trades across the platform?
Also is there anything else I really need to know?
A Nuclear switch is possible but Chicken Switch closes all trades that are the same symbol as the chart it was executed on.
Code: Select all
//+---CLOSE ALL OPEN TRADES ON SELECTED CHART------------------------------------------------------------------------+
if (OrdersTotal() == 0) return(0);
for (int i = OrdersTotal() - 1; i >= 0; i--){
if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES) == true){
if (OrderType() == 0 && OrderSymbol() == Symbol()){
ticket = OrderClose (OrderTicket(), OrderLots(), Bid, 3, CLR_NONE);
if (ticket == -1) Print ("Error: ", GetLastError());
if (ticket > 0) Print ("Position ", OrderTicket() ," closed");}
if (OrderType() == 1 && OrderSymbol() == Symbol()){
ticket = OrderClose (OrderTicket(), OrderLots(), Ask, 3, CLR_NONE);
if (ticket == -1) Print ("Error: ", GetLastError());
if (ticket > 0) Print ("Position ", OrderTicket() ," closed");}}}
Anything you are not familiar with is best tried on a Demo account first.