han.
发表于 2018-4-24 22:27:32
一键平仓 一键关掉所有挂单 脚本 EA 除去所有繁锁操作,方便快速。源码
991998967
发表于 2018-4-24 22:38:37
挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓挂单 一键平仓
han.
发表于 2018-4-24 22:53:28
一键平仓 一键关掉所有挂单 脚本 EA 除去所有繁锁操作,方便快速。源码
laseine001
发表于 2018-4-24 23:01:14
kkkkkkkkkkkkkkkkkkkkkkkkkkk
oksale
发表于 2018-4-24 23:01:47
4yrehgerghdfhdfhdf
郑大哥
发表于 2018-4-25 11:34:51
一键平仓 一键关掉所有挂单 等
来吧
发表于 2018-4-26 01:18:14
好好看看 。。。。。。。。。。。。。。。。。。。。。。
zzhai1972
发表于 2018-4-27 10:07:37
//+------------------------------------------------------------------+
//| 一键平仓含挂单全商品版脚本.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()
{
//---
int tick={-1};
int pingFlag=0,slipPage=3;
int j=0,i;
for(i=0;i
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
j++;
tick=OrderTicket();
Print("全部平仓:",tick);
}
else{Print("订单选择失败:",GetLastError());}
}
if(j!=0) //如果有持仓
{
for(i=1;i<=j;i++)
{
int ticket=tick;
if(OrderSelect(ticket,SELECT_BY_TICKET)==true)
{
int cmd=OrderType();
if(cmd==OP_BUY)
{
if(OrderClose(ticket,OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),slipPage)==false)
{pingFlag=1;Print("多头平仓失败:",GetLastError()," 订单号:",ticket);}
}
else if(cmd==OP_SELL)
{
if(OrderClose(ticket,OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),slipPage)==false)
{pingFlag=1;Print("空头平仓失败:",GetLastError()," 订单号:",ticket);}
}
else if(cmd==OP_BUYLIMIT)
{
if(OrderDelete(OrderTicket(),CLR_NONE)==false)
{pingFlag=1;Print("多头Limit挂单撤销失败:",GetLastError()," 订单号:",ticket);}
}
else if(cmd==OP_SELLLIMIT)
{
if(OrderDelete(OrderTicket(),CLR_NONE)==false)
{pingFlag=1;Print("空头Limit挂单撤销失败:",GetLastError()," 订单号:",ticket);}
}
else if(cmd==OP_BUYSTOP)
{
if(OrderDelete(OrderTicket(),CLR_NONE)==false)
{pingFlag=1;Print("多头Stop挂单撤销失败:",GetLastError()," 订单号:",ticket);}
}
else if(cmd==OP_SELLSTOP)
{
if(OrderDelete(OrderTicket(),CLR_NONE)==false)
{pingFlag=1;Print("空头Stop挂单撤销失败:",GetLastError()," 订单号:",ticket);}
}
}
else
{Print("选择订单失败:",GetLastError()," 订单号:",ticket);}
}//for
}//if
if(pingFlag==0)
{Alert("平仓成功");}
else
{Alert("平仓失败,再来一次");}
}
//+------------------------------------------------------------------+
飞花逐月
发表于 2018-4-29 11:12:51
谢谢楼主分享
艳阳高照
发表于 2018-4-29 20:25:33
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm