那位大神能把这个改成亏损16个点加一单 获利8个点加一单 不设止损止盈 目前是15钟加一单//+------------------------------------------------------------------+//| -===9919.mq4 |
//| aber8818 |
//| 168 |
//+------------------------------------------------------------------+
#property copyright "aber8818"
#property link "168"
extern int 一次n单=1;
extern int 多11空22不做120自动99=99;
double 止损=0,止盈=0;
double 涨几点开新=Point*88,亏几点开新=Point*160;
int 起步资金=10000;
int start()
{
double 一次几张=MathFloor(AccountBalance()/10000)/100;
int BUYS=0,SELLS=0,bs=0,ss=0;
double BUYSUMS=0,SELLSUMS=0;
for(int i0=OrdersTotal()-1;i0>=0;i0--)
{
OrderSelect(i0,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderLots()<=一次几张)
{
if(OrderType()==OP_SELL){SELLS++;SELLSUMS=SELLSUMS+OrderLots();}
else{BUYS++;BUYSUMS=BUYSUMS+OrderLots();}
if(OrderType()==OP_SELL && (OrderStopLoss()==0 && OrderTakeProfit()==0)){ss++;}
if(OrderType()==OP_BUY && (OrderStopLoss()==0 && OrderTakeProfit()==0)){bs++;}
}
}
int mark=00;
for(int id=OrdersTotal()-1;id>=0;id--)
{
OrderSelect(id,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderLots()<=一次几张)
{
if(OrderType()==OP_SELL){mark=22;break;}
if(OrderType()==OP_BUY){mark=11;break;}
}
}
if(多11空22不做120自动99==99)
{
double lD1=iCustom(Symbol(),PERIOD_H1,"sdlylzs1",5,15,0,1);
double hD1=iCustom(Symbol(),PERIOD_H1,"sdlylzs1",5,15,1,1);
double llD1=iCustom(Symbol(),PERIOD_H1,"sdlylzs1",5,15,0,2);
double hhD1=iCustom(Symbol(),PERIOD_H1,"sdlylzs1",5,15,1,2);
if(hD1!=hhD1 && mark!=22){mark=22;}
if(lD1!=llD1 && mark!=11){mark=11;}
}
if(多11空22不做120自动99==22 || mark==22)
{
for(int i2=OrdersTotal()-1;i2>=0;i2--)
{
OrderSelect(i2,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol())
if(OrderType()==OP_BUY && OrderProfit()/OrderLots()*100>66)// && OrderStopLoss()==0
OrderClose(OrderTicket(),OrderLots(),Bid,3);
}
if(BUYSUMS>=SELLSUMS-一次n单*一次几张)
OrderSend(Symbol(),OP_SELL,一次几张,Bid,3,止损,止盈,0,16384,0);
if(ss<一次n单)
{
OrderSend(Symbol(),OP_SELL,一次几张,Bid,3,止损,止盈,0,16384,0);
}
}
if(多11空22不做120自动99==11 || mark==11)
{
for(int i21=OrdersTotal()-1;i21>=0;i21--)
{
OrderSelect(i21,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol())
if(OrderType()==OP_SELL && OrderProfit()/OrderLots()*100>66)// && OrderStopLoss()==0
OrderClose(OrderTicket(),OrderLots(),Ask,3);
}
if(BUYSUMS-一次n单*一次几张<=SELLSUMS)
OrderSend(Symbol(),OP_BUY,一次几张,Ask,3,止损,止盈,0,16384,0);
if(bs<一次n单)
{
OrderSend(Symbol(),OP_BUY,一次几张,Ask,3,止损,止盈,0,16384,0);
}
}
if(多11空22不做120自动99==120)
for(int iiiii=0;iiiii<=OrdersTotal();iiiii++)
{
OrderSelect(iiiii,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&& OrderProfit()/OrderLots()/10>9)
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,3);
else
OrderClose(OrderTicket(),OrderLots(),Bid,3);
}
int ys=MathMod(SELLSUMS*100+BUYSUMS*100,3);
for(int im2=OrdersTotal()-1;im2>=0;im2--)
{
OrderSelect(im2,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderLots()<=一次几张)
{
if(OrderType()==OP_SELL && OrderOpenPrice()-Bid>涨几点开新)
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*88,OrderOpenPrice()-Point*3333,0);}
if(OrderType()==OP_SELL && OrderOpenPrice()-Bid<-1*亏几点开新 && ys==1 && OrderStopLoss()==0 && OrderTakeProfit()==0)
{OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()-Point*188,0);break;}
if(OrderType()==OP_SELL && OrderOpenPrice()-Bid<-1*亏几点开新 && ys==2 && OrderStopLoss()==0 && OrderTakeProfit()==0)
{OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()-Point*588,0);break;}
}
}
for(int im1=OrdersTotal()-1;im1>=0;im1--)
{
OrderSelect(im1,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderLots()<=一次几张)
{
if(OrderType()==OP_BUY && Ask-OrderOpenPrice()>涨几点开新)
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*88,OrderOpenPrice()+Point*3333,0);}
if(OrderType()==OP_BUY && Ask-OrderOpenPrice()<-1*亏几点开新 && ys==1 && OrderStopLoss()==0 && OrderTakeProfit()==0)
{OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()+Point*188,0);break;}
if(OrderType()==OP_BUY && Ask-OrderOpenPrice()<-1*亏几点开新 && ys==2 && OrderStopLoss()==0 && OrderTakeProfit()==0)
{OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()+Point*588,0);break;}
}
}
//========================================================
double dsk=0,ksk=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TIME);
if(OrderSymbol()==Symbol() && OrderType()==OP_SELL )ksk=ksk+OrderLots();
if(OrderSymbol()==Symbol() && OrderType()==OP_BUY )dsk=dsk+OrderLots();
}
Comment(dsk," ",ksk);
double 扛=0;if(OrdersTotal()>0 && dsk!=ksk)扛=MathFloor(AccountFreeMargin()/MathMax(dsk,ksk)/10);
if(dsk==ksk)扛=1999;
ObjectDelete("k");
ObjectCreate("k", OBJ_LABEL, 0, 0, 0);
ObjectSetText("k",扛 ,60, "宋体", Yellow);
ObjectSet("k", OBJPROP_XDISTANCE, 0);
ObjectSet("k", OBJPROP_YDISTANCE, 56);
//-------------------------------------------------------
double dsa=0,ksa=0;
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_SELL)ksa=ksa+OrderLots();
if(OrderType()==OP_BUY)dsa=dsa+OrderLots();
}
double 已平单量=0;
double 已收利润=0;
for(int ii=OrdersHistoryTotal()-1;ii>=0;ii--)
{
OrderSelect(ii,SELECT_BY_POS,MODE_HISTORY);
if(OrderType()==OP_SELL || OrderType()==OP_BUY)
{已平单量=已平单量+OrderLots();已收利润=已收利润+OrderProfit();}
}
Comment(dsa,"=",ksa," ",AccountLeverage()/100," 底仓计划=",MathFloor(AccountBalance()/100)/100," ",AccountEquity()," ",已平单量,"=",已收利润," ");
ObjectDelete("mm");
ObjectCreate("mm",OBJ_RECTANGLE,0,Time[13],iOpen(Symbol(),PERIOD_MN1,0)+Point*2*10,Time[17],iOpen(Symbol(),PERIOD_MN1,0)-Point*2*10);
ObjectSet("mm",OBJPROP_COLOR,Yellow);
ObjectDelete("ww");
ObjectCreate("ww",OBJ_RECTANGLE,0,Time[9],iOpen(Symbol(),PERIOD_W1,0)+Point*2*10,Time[13],iOpen(Symbol(),PERIOD_W1,0)-Point*2*10);
ObjectSet("ww",OBJPROP_COLOR,Lime);
ObjectDelete("dd");
ObjectCreate("dd",OBJ_RECTANGLE,0,Time[5],iOpen(Symbol(),PERIOD_D1,0)+Point*2*10,Time[9],iOpen(Symbol(),PERIOD_D1,0)-Point*2*10);
ObjectSet("dd",OBJPROP_COLOR,Red);
for(i=1;i<=38;i++)
{
double L=iCustom(Symbol(),0,"sdlylzs1",5,15,0,i);
double LL=iCustom(Symbol(),0,"sdlylzs1",5,15,0,i+1);
double H=iCustom(Symbol(),0,"sdlylzs1",5,15,1,i);
double HH=iCustom(Symbol(),0,"sdlylzs1",5,15,1,i+1);
ObjectDelete("H1H"+i);
ObjectDelete("H1L"+i);
if(LL==L)
{ObjectCreate("H1L"+i,OBJ_HLINE,0,Time[0],L);
ObjectSet("H1L"+i,OBJPROP_COLOR,Green);}
if(HH==H)
{ObjectCreate("H1H"+i,OBJ_HLINE,0,Time[0],H);
ObjectSet("H1H"+i,OBJPROP_COLOR,Green);}
}
return(0);
}
|