/*-----------------------------+ | | | Shared by www.Aptrafx.com | | | +------------------------------*/ //+------------------------------------------------------------------+ //| CloseAllTrades.mq4 | //| Copyright © 2005, Renato | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, rodrigokaus" #property link "http://www.forex-tsd.com/expert-advisors-metatrader-4/703-100-pips.html" extern color clCloseBuy = Yellow; extern color clCloseSell = Yellow; extern string Name_Expert = "CloseAllTrades"; void deinit() { Comment(""); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start(){ CloseAllTrades(); return (0); } void CloseAllTrades() { for (int i=0; i<OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol()==Symbol()) { if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,GetSlippage(),clCloseBuy); if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,GetSlippage(),clCloseSell); if (OrderType()==OP_SELLSTOP || OrderType()==OP_SELLLIMIT || OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT) OrderDelete(OrderTicket()); } } } } double GetSlippage() { return((Ask-Bid)/Point); }
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It Closes Orders by itself
Other Features: