源码:
//+------------------------------------------------------------------+
//|RSI--------QQEV01.mq4 |
//|liusong |
//| qq: |
//+------------------------------------------------------------------+
#property copyright "liusong"
#property link"qq:569638390"
extern double a = 1.2;
extern double b = 43.2365;
extern double c = 50.2589;
extern double Lots = 0.1;
extern double slippage=3.0;
extern double diancha=10.0;
extern double kuisun=100.0;
extern intmaxlots =1;
extern intSL = 2000;
extern intduan_sl=20;
extern intTP= 20000;
extern stringMT4LevelStopReversevB0设置 =" MT4-LevelStop-Reverse-vB0设置";
extern bool UseATRMode = true;
extern int NonATRStopPips =1800;
extern int ATRPeriod = 9;
extern double ATRMultiplier = 2.0;
extern int ATRSmoothing = 0;
extern color UpArrowColor = DodgerBlue;
extern color DnArrowColor = OrangeRed;
extern int ArrowDistance = 0;
int start()
{
//----
doubleqqe_0,qqe_1,qqe_2,qqe_3,qqe_5,qqe_6,qqe_7,qqe_day_1,qqe_day_2;
double sell,buy,i,guadan,lirun;
doublemt4_stop_1,mt4_stop_2,chazhi,chazhi_1;
qqe_day_1 = iCustom (Symbol(), PERIOD_D1, "###QQE_Alert_MTF_v3###", 0, 0);
qqe_day_2 = iCustom (Symbol(), PERIOD_D1, "###QQE_Alert_MTF_v3###", 1, 0);
qqe_0 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 0);
qqe_1 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 1);
qqe_2 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 2);
qqe_3 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 3);
qqe_5 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 5);
qqe_6 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 6);
qqe_7 = iCustom (Symbol(), NULL, "###QQE_Alert_MTF_v3###", 0, 7);
mt4_stop_1 = iCustom(NULL,0,"MT4-LevelStop-Reverse-vB0-3",
UseATRMode,NonATRStopPips,ATRPeriod,ATRMultiplier,ATRSmoothing,UpArrowColor,DnArrowColor,ArrowDistance,0,1);
mt4_stop_2 = iCustom(NULL,0,"MT4-LevelStop-Reverse-vB0-3",
UseATRMode,NonATRStopPips,ATRPeriod,ATRMultiplier,ATRSmoothing,UpArrowColor,DnArrowColor,ArrowDistance,0,2);
chazhi=mt4_stop_1-mt4_stop_2;
if(chazhi>0){
chazhi_1=chazhi;
}
else{
if(chazhi 0 ){
for(i=OrdersTotal()-1;
i>=0;
i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderType()==OP_SELLLIMIT){
if(((qqe_6-qqe_5)>a)qqe_6>c qqe_7a)qqe_2>c qqe_3a)qqe_6>c qqe_70){
OrderModify(OrderTicket(),OrderOpenPrice(),mt4_stop_1,0,0,Blue);
}
/*if(((qqe_1-qqe_2)>a)){
buy= NormalizeDouble((Low[2]+Close[2])/2, Digits);
OrderModify(OrderTicket(),OrderOpenPrice(),0,buy+diancha*Point,0,Blue);
}*/
if(0-lirun>=SL/10){
OrderClose(OrderTicket(),OrderLots(),Ask,slippage*Point,White);
Sleep(5000);
}
}
}
}
if (OrdersTotal( ) > 0 ){
for(i=OrdersTotal()-1;
i>=0;
i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderType()==OP_BUYLIMIT)
{
if(((qqe_5-qqe_6)>a) qqe_6=qqe_6
((qqe_1-qqe_2)>a) qqe_2=qqe_2){
buy= NormalizeDouble((Low[2]+Close[2])/2, Digits);
OrderModify(OrderTicket(),buy,buy-SL*Point,buy+TP*Point,0,Blue);
}
else{
if (((qqe_5-qqe_6)>a) qqe_6=qqe_6){
OrderDelete(OrderTicket(),Blue);
}
}
}
if(OrderType()==OP_BUY){
lirun =OrderProfit();
Comment("账户利润", DoubleToStr(OrderProfit(), 2));
if(chazhi_1>0){
OrderModify(OrderTicket(),OrderOpenPrice(),mt4_stop_1,0,0,Blue);
}
/*if(((qqe_2-qqe_1)>a)){
sell= NormalizeDouble((High[2]+Close[2])/2, Digits);
OrderModify(OrderTicket(),OrderOpenPrice(),0,sell-diancha*Point,0,Blue);
} */
if(0-lirun>=SL/10){
OrderClose(OrderTicket(),OrderLots(),Bid,slippage*Point,White);
Sleep(5000);
}
}
}
}
sell= NormalizeDouble((High[2]+Close[2])/2, Digits);
if (totala) qqe_2>c qqe_3 qqe_day_2 ((qqe_1-qqe_2)>a) qqe_2=qqe_2){
OrderSend(Symbol(),OP_BUYLIMIT,Lots,buy,slippage*Point,buy-SL*Point,buy+TP*Point,"buy",12345,0,Red);
}
//----
return(0);
}
//+------------------------------------------------------------------+