Archenius.
2014.01.02
|
|
0 0
23879
|
Az adott páron minden nyitott pozíciót záró script.
#property copyright "" #property link "" //#property show_inputs
extern string Pair = ""; extern string Note = "If Pair left blank closes pair on chart"; int slippage=5;
//+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- if ( Pair == "" ) Pair = Symbol(); //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ void Closeall() { int totalorders = OrdersTotal(); for(int n=totalorders-1;n>=0;n--) { OrderSelect(n, SELECT_BY_POS); bool result = false; if ( OrderSymbol() == Pair ) { //Close opened long positions if ( OrderType() == OP_BUY )result= OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), slippage, White ); //Close opened short positions if ( OrderType() == OP_SELL )result= OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), slippage, White ); //Close pending orders if ( OrderType() > 1 )result= OrderDelete( OrderTicket() ); } } return; }
int start() { Closeall();
return(0); } |
Előzmény: margithid (23875)
|
|