有您的持续关注
我们会做得更好

GET LUCKY (Modified) v101 EA



GET LUCKY (Modified) v101 EA采用动态仓位及加码策略。没有止损盈利可观的同时也伴随高风险。

本网收集整理智能交易EA仅为MQL4编程爱好者提供语法及相关编程技巧的学习研究之用,智能交易存在极高的风险测试请用模拟盘,请勿用于实盘。GET LUCKY (Modified) v101 EA源码:

//+------------------------------------------------------------------+
//|                                                    GET LUCKY.mq4 |
//|                                 Copyright @2009, Pierre Mouawad |
//+------------------------------------------------------------------+
#property copyright "Copyright @2008, Pierre Mouawad"
#property link      "http://www.125808047.com/"

//---- input parameters
extern int       DemPeriod  = 12;
extern double    DemLevel1  = 0.3;
extern double    DemLevel2  = 0.7;
extern double    Step       = 0.003;
extern double    Max        = 0.2;
extern int       TakeProfit = 125;
extern double    Perc       = 3;     //--- Percentage of Account to invest
extern double    Lots       = 1;     //--- If Perc=0, Lots is Fixed to this amount
extern double    Mult       = 2;
extern int       MaxTrades  = 4;     //--- Maximum Number of Trades to Open
extern int       Level      = 70;    //--- the level where the EA starts averaging
extern int       Slippage   = 10;
extern int       LotC       = 500;   //--- Lot Cost (based on margin requirement and type of account

int    TradeType=0, TradeCount=0;
double Lotsi=0, TradePrice=0, NewTarget=0, NewStop=0, AverageLong=0, AverageShort=0;
double x=0;
bool cg = false;
//+------------------------------------------------------------------+
int digits,multi;
double point;

int init()
{
   digits=Digits;
   if(Digits==3 || Digits==5){point=Point*10;multi=10;}else{point=Point;multi=1;}
return(0);
}

void deinit() {
  Comment("www.125808047.com");
}


int start()
   {
   
   double H, Hi, L, Lo, Cl, Clo1, Clo2, dm, sar, sar1, sar2;
  
   H    = High[0];
   Hi   = High[1];
   L    = Low[0];
   Lo   = Low[1];
   Cl   = Close[0];
   Clo1 = Close[1];
   Clo2 = Close[2];
   
   dm    = iDeMarker(NULL, 0, DemPeriod, 0);
   
   sar   = iSAR(NULL, 0, Step, Max, 0);
   sar1  = iSAR(NULL, 0, Step, Max, 1);
   sar2  = iSAR(NULL, 0, Step, Max, 2);

//-- check for open orders and their details
   int Total=OrdersTotal();
   if(TradeCount==MaxTrades && Total==0) TradeCount=0;
   for(int cnt=0; cnt<Total; cnt++)
      {
      cg = OrderSelect(cnt, SELECT_BY_POS);
      if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
         {
         TradeType=1;
         TradeCount++;
         TradePrice    = OrderOpenPrice();
         NewTarget     = OrderTakeProfit();
         NewStop       = OrderStopLoss();
         Lotsi         = OrderLots();
       
         if(TradeCount>1)
            {
           cg = OrderSelect(cnt-1, SELECT_BY_POS);
            if(OrderTakeProfit() != NewTarget)
            cg = OrderModify(OrderTicket(),OrderOpenPrice(),NewStop,NewTarget,0);
            }
         }
      if(OrderSymbol()==Symbol() && OrderType()==OP_SELL)
         {
         TradeType=2;
         TradeCount++;
         TradePrice    = OrderOpenPrice();
         NewTarget     = OrderTakeProfit();
         NewStop       = OrderStopLoss();
         Lotsi         = OrderLots();
         
         if(TradeCount>1)
            {
            cg = OrderSelect(cnt-1, SELECT_BY_POS);
            if(OrderTakeProfit() != NewTarget)
               cg = OrderModify(OrderTicket(),OrderOpenPrice(),NewStop,NewTarget,0);
            }
         
         }
      }
      
   //-- Look for initial entries
   if(TradeCount==0) 
      {
      //-- Long
        if (Total==0 && x!=iTime(0,0,0) && Bid>Hi && (Bid-Hi)<(5*point) 
                     && Bid>sar && Clo1>sar1 && Clo2>sar2 && dm<DemLevel1 && Cl==H)
         {
         if (Perc!=0) Lots=NormalizeDouble((AccountBalance()*(Perc/100)/LotC),2);
               {if (Lots>6) Lots=6;}
         cg = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage*multi, 0,
                    Ask+(TakeProfit*point),"LONG Position Initiated",0,0,Navy);
         return(0);
         }
                       
      //-- Short
        if (Total==0 && x!=iTime(0,0,0) && Bid<Lo && (Lo-Bid)<(5*point) 
                     && Bid<sar && Clo1<sar1 && Clo2<sar2 && dm>DemLevel2 && Cl==L)
         {
         if (Perc!=0) Lots=NormalizeDouble((AccountBalance()*(Perc/100)/LotC),2);
               {if (Lots>6) Lots=6;}
         cg = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*multi, 0,
                   Bid-(TakeProfit*point),"SHORT Position Initiated",0,0,Red);
         return(0);
         }
      }   
      
   //-- Average Positions
   
      //-- average long
      if(TradeCount>0 && TradeCount<MaxTrades && TradeType==1 && (TradePrice-Ask)>=Level*point && Ask>sar)
              {
              Lotsi       = NormalizeDouble(Lotsi*Mult,2);
              AverageLong = (((MaxTrades-TradeCount)*Level)*point);
                if(AverageLong<11*point) AverageLong=11*point;
      
              cg = OrderSend(Symbol(),OP_BUY,Lotsi,Ask,Slippage*multi, 0,
                        Ask+((TakeProfit)*point),"LONG Averaging Initiated",0,0,Green);
              }
      
      //-- average short
      if(TradeCount>0 && TradeCount<MaxTrades && TradeType==2 && (Bid-TradePrice)>=Level*point && Bid<sar)
              {
              Lotsi        = NormalizeDouble(Lotsi*Mult,2);
              AverageShort = (((MaxTrades-TradeCount)*Level)*point);
              if(AverageShort<11*point) AverageShort=11*point;
      
              cg = OrderSend(Symbol(),OP_SELL,Lotsi,Bid,Slippage*multi, 0,
                        Bid-((TakeProfit)*point),"SHORT Averaging Initiated",0,0,DarkOrchid);
              }
      
            
      TradeCount=0;
      
      return(0);
      }
//+------------------------------------------------------------------+

如您喜欢此文章请点下面分享按钮↴峰汇在线 » GET LUCKY (Modified) v101 EA
上一篇:
下一篇:
分享到:更多 ()