a784790
发表于 2019-4-15 18:57:06
6666666666666666666666666
qy1974810
发表于 2019-4-21 09:19:40
kkkkkkkkkkkkkkkk
qiu
发表于 2019-4-21 10:13:21
000000000000000000000
风云无为
发表于 2019-4-21 10:17:52
if (GetbuyLots()>GetsellLots()) lock(OP_SELL);
if (GetbuyLots()<GetsellLots()) lock(OP_BUY);
}
//--------------------------------------------------------------------------*/
return (0);
}
//+--------------------------------锁仓程序------------------------------+
void lock(int Ordertype) {
double Price1,Lot1,Price2,Lot2;
if (Ordertype == OP_BUY) {
OrderSend(Symbol(), OP_BUY, GetsellLots()-GetbuyLots(), Ask, 3, 0, 0, 0, 0, 0, BlueViolet);
locked = TRUE;
}
if (Ordertype == OP_SELL) {
OrderSend(Symbol(), OP_SELL, GetbuyLots()-GetsellLots(), Bid, 3, 0, 0, 0, 0, 0, BlueViolet);
locked = TRUE;
}
return (0);
}
//+------------------------------------------------------------------+/
//+-------------------------计算开单数-------------------------------+
int GetOrdersTotal(int intOrderType)
{
int buy=0,sell=0,total=0;
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue;
if(OrderSymbol()!=Symbol()) continue;
//---- check order type
if(OrderType()==OP_BUY ) {buy++;}
if(OrderType()==OP_SELL) {sell++;}
total++;
}
if (intOrderType==OP_BUY)return(buy);
if (intOrderType==OP_SELL) return(sell);
if (intOrderType==6) return(total);
return(99999);
}
//+------------------------------------------------------------------+
//+-------------------------计算buy下单量---------------------------+
double GetbuyLots()
{
datetime lasttime=Time;
double buylots,selllots;
for(inti=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue;
if(OrderSymbol()!=Symbol()) continue;
if(OrderType()==OP_BUY)
{
buylots=OrderLots()+buylots;
}
}
return(buylots);
}
//+------------------------------------------------------------------+
//+-------------------------计算sell下单量---------------------------+
double GetsellLots()
{
datetime lasttime=Time;
double selllots;
for(inti=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue;
if(OrderSymbol()!=Symbol()) continue;
if(OrderType()==OP_SELL)
{
selllots=OrderLots()+selllots;
}
}
return(selllots);
}
//+--------------------------------------------------------------
wuji125999
发表于 2019-4-21 10:34:44
sunqhd618
发表于 2019-4-21 10:50:58
1111111111111111
zhengshaozhang
发表于 2019-4-21 11:06:35
拿来炒比特币合约还是很合适的!外汇通用!
qwer157322451
发表于 2019-4-21 12:42:34
DDDDDDDDDDDDDDDDDDDDD
jian66
发表于 2019-4-21 12:52:35
学习一下。。。
Bingwen
发表于 2019-4-22 04:25:59
6666666666666666666666666