18评论

0收藏

各路高人帮帮忙!

avatar ゛北城别 | 4847 人阅读 | 18 人评论 | 2011-11-28

cci指标我就改了个时间参数,然后就不开仓了 源码在这:
  
  extern int magic=1234;                   // magic number required if you use different settings on a same pair, same timeframe
  
  extern string moneymanagement=\"Money Management\";
  
  extern double lots=0.1;                  // lots size
  extern bool mm=true;                    // enable risk management
  extern int mmmode=0;                     // 0=freemargin, 1=equity, 2=balance
  extern double longrisk=0.24;                    // risk in percentage of the account
  extern double shortrisk=0.24;                    // risk in percentage of the account
  extern double minlot=0.01;               // minimum lots size
  extern double maxlot=100;                // maximum lots size
  extern double lotdigits=2;               // lot digits, 1 for mini, 2 for micro
  //extern bool martingale=false;          // enable the martingale
  //extern double multiplier=2.0;          // multiplier used for the martingale
  //extern bool basketpercent=false;       // enable the basket percent
  //extern double profit=10;               // close all orders if a profit of 10 percents has been reached
  //extern double loss=30;                 // close all orders if a loss of 30 percents has been reached
  
  extern string ordersmanagement=\"Order Management\";
  
  extern bool ecn=false;                   // make the expert compatible with ecn brokers
  extern bool oppositeclose=false;         // close the orders on an opposite signal
  extern bool reversesignals=false;        // reverse the signals, long if short, short if long
  extern int maxtrades=100;                // maximum trades allowed by the traders
  extern int tradesperbar=1;               // maximum trades per bar allowed by the expert
  extern bool hidesl=false;                // hide stop loss
  extern bool hidetp=false;                // hide take profit
  extern double stoploss=0;                // stop loss
  extern double takeprofit=0;              // take profit
  extern double trailingstart=0;           // profit in pips required to enable the trailing stop
  extern double trailingstop=0;            // trailing stop
  extern double trailingprofit=0;          // trailing profit
  extern double trailingstep=1;            // margin allowed to the market to enable the trailing stop
  extern double breakevengain=0;           // gain in pips required to enable the break even
  extern double breakeven=0;               // break even
  int expiration=0;                        // expiration in minutes for pending orders
  double slippage=0;                       // maximum difference in pips between signal and order
  extern double maxspread=100;             // maximum spread allowed by the expert
  
  extern string entrylogics=\"Entry Logics\";
  
  extern int longpercci=90;(这里原值是24)
  extern int longsensitivity=10;
  extern double longlotsincrement=0.01;
  extern int longtargetpips=25;
  extern double longtargetpct=0.085;
  extern int shortpercci=90;(这里原值是24)
  extern int shortsensitivity=10;
  extern double shortlotsincrement=0.01;
  extern int shorttargetpips=25;
  extern double shorttargetpct=0.085;
  extern int shift=1;                      // bar in the past to take in consideration for the signal
  
  
  extern string comment=\"EA\";              // comment to display in the order
  
  int i,bc=-1,lastorder,buyorderprofit,sellorderprofit;
  int nstarthour,nendhour,nfridayhour,tpb,tps,cnt,ticket,number,tries=100;
  double lastbuyopenprice,lastsellopenprice,lastbuyprofit,lastsellprofit;
  double cb,sl,tp,ilots,lastbuylot,lastselllot,lastlot,lastprofit,mlots,buypips,sellpips;
  string istarthour,istartminutes,iendhour,iendminutes,ifridayhour,ifridayminutes;
  datetime t0,t1,tstart,tend,tfriday,lastbuyopentime,lastsellopentime;
  
  double pt,mt;
  int dg;
  
  int init(){
     t0=Time[0];
     t1=Time[0];
     dg=Digits;
     if(dg==3 || dg==5){pt=Point*10;mt=10;}else{pt=Point;mt=1;}
     return(0);
  }
  
  int start(){
  /*
     GlobalVariableSet(\"vGrafBalance\",AccountBalance());
     GlobalVariableSet(\"vGrafEquity\",AccountEquity());
  */
  
     if(breakevengain>0)movebreakeven(breakevengain,breakeven);
     if(trailingstop>0)movetrailingstop(trailingstart,trailingstop);
     if(trailingprofit>0)movetrailingprofit(trailingstart,trailingprofit);
     //if(basketpercent)closebasketpercent(profit,loss);
  /*
     lastbuylot=0;
     lastselllot=0;
     lastorder=0;
  
     if(OrdersHistoryTotal()>0){
        for(i=0;i=longtargetpips) || (longtargetpct>0 && buyorderprofit>=AccountBalance()*longtargetpct/100))closebuy();
     if((oppositeclose && buy) || (shorttargetpips>0 && sellpips>=shorttargetpips) || (shorttargetpct>0 && sellorderprofit>=AccountBalance()*shorttargetpct/100))closesell();
  
     if(hidetp || hidesl){hideclosesell();hideclosebuy();}
  /*
     if(generalfilter){
        nstarthour=starthour+(gmtshift);if(nstarthour>23)nstarthour=nstarthour-24;
        if(nstarthour9)istarthour=nstarthour;
        if(startminutes9)istartminutes=startminutes;
        tstart=StrToTime(istarthour+\":\"+istartminutes);
  
        nendhour=endhour+(gmtshift);if(nendhour>23)nendhour=nendhour-24;
        if(endhour9)iendhour=nendhour;
        if(endminutes9)iendminutes=endminutes;
        tend=StrToTime(iendhour+\":\"+iendminutes);
     }
     if(fridayfilter){
        nfridayhour=fridayhour+(gmtshift);if(nfridayhour>23)nfridayhour=nfridayhour-24;
        if(nfridayhour9)ifridayhour=nfridayhour;
        if(fridayminutes9)ifridayminutes=fridayminutes;
        tfriday=StrToTime(ifridayhour+\":\"+ifridayminutes);
     }
     if((generalfilter && (nstarthournendhour && TimeCurrent()tend))
     || (tradesunday==false && DayOfWeek()==0) || (fridayfilter && DayOfWeek()==5 && TimeCurrent()>tfriday))return(0);
  */
     if((Ask-Bid)>maxspread*mt*pt)return(0);
     if((count(OP_BUY)+count(OP_SELL))>=maxtrades)return(0);
  
  
     int expire=0;
     if(expiration>0)expire=TimeCurrent()+(expiration*60)-5;
  
     ticket=0;
     number=0;
     if(buy && tpb=0))*/)lots=longlotsoptimized();
        /*if(martingale)ilots=mlots;else*/
        if(lastbuyopenprice!=0)ilots=lots+NormalizeDouble(longlotsincrement*NormalizeDouble((MathAbs(lastbuyopenprice-Ask)/pt)/longsensitivity,0),lotdigits);else ilots=lots;
        if(ecn==false){
           while(ticket=takeprofit*OrderLots()*10)){
              OrderClose(OrderTicket(),OrderLots(),Bid,slippage*mt);
           }
        }
     }
  }
  
  void hideclosesell(){
     RefreshRates();
     if(OrdersTotal()>0){
        for(i=OrdersTotal();i>=0;i--){
           OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
           if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELL
           && (hidesl && stoploss>0 && OrderProfit()0 && OrderProfit()>=takeprofit*OrderLots()*10)){
              OrderClose(OrderTicket(),OrderLots(),Ask,slippage*mt);
           }
        }
     }
  }
  /*
  //|---------delete
  
  void delete(int type){
     if(OrdersTotal()>0){
        for(i=OrdersTotal();i>=0;i--){
          OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
          if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==type){
            OrderDelete(OrderTicket());
          }   
        }
     }
  }
  */
  //|---------breakeven
  
  void movebreakeven(double breakevengain,double breakeven){
     RefreshRates();
     if(OrdersTotal()>0){
        for(i=OrdersTotal();i>=0;i--){
           OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
           if(OrderType()=NormalizeDouble(breakevengain*pt,dg)){
                    if((NormalizeDouble((OrderStopLoss()-OrderOpenPrice()),dg)=NormalizeDouble(breakevengain*pt,dg)){
                    if((NormalizeDouble((OrderOpenPrice()-OrderStopLoss()),dg)0){
        for(i=OrdersTotal();i>=0;i--){
           OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
           if(OrderType()NormalizeDouble(OrderOpenPrice()+trailingstart*pt,dg)
                 && NormalizeDouble(OrderStopLoss(),dg)
""
还没有人打赏,支持一下

评论|共 18 个

我喜欢

发表于 2012-11-25 16:59:05 | 显示全部楼层

说的不错  

黑平台ccn

发表于 2012-11-25 16:59:05 | 显示全部楼层

EA!EA都要被他弄疯了!  

tianxiahui578

发表于 2012-11-25 18:07:25 | 显示全部楼层

感謝樓主  

ccn无耻

发表于 2012-11-25 18:07:25 | 显示全部楼层

顶你一下,好贴要顶!  

二元期权1

发表于 2012-11-25 18:07:25 | 显示全部楼层

我帮你 喝喝  

重庆痞子

发表于 2012-11-25 18:07:25 | 显示全部楼层

唉,悲催的外汇。。  

dqrhteny

发表于 2012-11-25 18:07:25 | 显示全部楼层

哪里可以下载到好的EA哦  

love869

发表于 2012-11-25 18:07:25 | 显示全部楼层

人气还要再提高  

雨中一根毛

发表于 2012-11-25 18:07:25 | 显示全部楼层

这贴子你会收藏吗  

12下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则