MT4自动 一键平仓 一键下单 一键买 一键卖 多空 EA脚本

//+——————————————————————+
//|                                                        close.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+——————————————————————+
#property copyright “Copyright 2015, MetaQuotes Software Corp.”
#property link      “https://www.mql5.com”
#property version   “1.00”
#property strict
//+——————————————————————+
//| Script program start function                                    |
//+——————————————————————+
void OnStart()
{
bool bOrderClose;

for (int i=OrdersTotal(); i>=0; i–)
{

if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;

if ( OrderSymbol() == Symbol() && OrderType() == OP_BUY )
bOrderClose = OrderClose(OrderTicket(),OrderLots(), Bid, 1,clrNONE);

if ( OrderSymbol() == Symbol() && OrderType() == OP_SELL )
bOrderClose = OrderClose(OrderTicket(),OrderLots(), Ask, 1,clrNONE);

RefreshRates();
}
}
//+——————————————————————+

//+——————————————————————+
//|                                                         sell.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+——————————————————————+
#property copyright “Copyright 2015, MetaQuotes Software Corp.”
#property link      “https://www.mql5.com”
#property version   “1.00”
#property strict
//+——————————————————————+
//| Script program start function                                    |
//+——————————————————————+
void OnStart()
{
//—

OrderSend(Symbol(),OP_SELL,0.01,Ask,1,Bid+100*Point,Bid-100*Point);
return;
}
//+——————————————————————+

//+——————————————————————+
//|                                                          buy.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+——————————————————————+
#property copyright “Copyright 2015, MetaQuotes Software Corp.”
#property link      “https://www.mql5.com”
#property version   “1.00”
#property strict
//+——————————————————————+
//| Script program start function                                    |
//+——————————————————————+
void OnStart()
{
//—
OrderSend(Symbol(),OP_BUY,0.01,Ask,1,Bid-100*Point,Bid+100*Point);
return;
}
//+——————————————————————+