25评论

0收藏

模糊逻辑交易程序原代码

avatar 快速开始 | 6061 人阅读 | 25 人评论 | 2011-09-20

模糊逻辑交易程序原代码
  /* 模糊逻辑交易程序原代码。仅供学习之用,在实际交易中使用后果自负。*/
  //+------------------------------------------------------------------+
  //| _Fuzzy logic_.mq4 |
  //+------------------------------------------------------------------+
  /*
  Description:
  There are lots of materials about the indistinct systems, so specifically about the EA:
  
  
  1) The estimation is performed on the basis of values of five indicators (Gator, WPR, AC, DeMarker and RSI). The estimation is performed on the basis of trapezoidal membership functions.
  
  2) You can modify the ranking and the weight of the properties directly in the code.
  
  3) You can use not only the indicators specified above, but many other stuff (i.e. ones that you prefer to use), as the basis for the indistinct estimation (buy, sell, do nothing).
  
  On the whole, the EA code is intended for practical acquaintance with the techonlogy of indistinct estimation of the current situation on the market. So I recommend to use, and also modify, it, after theory studying. A. Nedosekin\'s material Osnovy teoryi nechetnoy ocenky (The basics of indistinct estimation theory) should be enough for the primary introduction (the technology is a bit different there, but the theory itself is decribed fully well).
  
  
  
  
  Advices:
  If you are going to implement your own criterions of estimation instead of five embedded indicators, I recommend to divide these criterions into the borders of indistinct estimations (array arGator[7] in the code, etc.).
  Do not try to overoptimize the parameters of memebership function (they are not taken out to the external varibles in the code), because it won\'t bring any significant effect, believe me, it\'s verified.
  
  Experiment - I think that the indistinct logic as a technology of decision making is without a rival. May be it will help somebody to win the championship.
  
  
  */
  #define MAGICMA 16419780400
  
  double Lots = 0.1;
  extern int TrailingStop = 35;
  extern double PercentMM = 8;
  extern double DeltaMM = 0;
  extern int InitialBalance = 10000;
  bool UseMM = true;
  extern double SL = 60;
  bool FirstSL = true;
  
  //######################################################################################################################################
  double LotsOptimized()
  {
  double volume,TempVolume, F;
  TempVolume=Lots;
  
  if (UseMM) TempVolume =0.00001*(AccountBalance()*(PercentMM+DeltaMM)-InitialBalance*DeltaMM);
  
  volume=NormalizeDouble(TempVolume,2);
  
  if (volume>MarketInfo(Symbol(),MODE_MAXLOT)) volume=MarketInfo(Symbol(),MODE_MAXLOT);
  if (volume=arGator[4]){Rang[0,2]=1;}
  //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //2)========================================================WPR=======================================================
  if (WPR=arWPR[0] && WPR=arWPR[1] && WPR=arWPR[2] && WPR=arWPR[3] && WPR=arWPR[4] && WPR=arWPR[5] && WPR=arWPR[6] && WPR=arWPR[7]){Rang[1,4]=1;}
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //3)============================================================AC=====================================================
  if (AC10){tempAC_s=5;}
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  if (tempAC_b==arAC[0] || tempAC_b==arAC[1]){Rang[2,0]=1;}
  if (tempAC_b==arAC[2] || tempAC_b==arAC[3]){Rang[2,1]=1;}
  
  if (tempAC_s==arAC[4] || tempAC_s==arAC[5]){Rang[2,3]=1;}
  if (tempAC_s==arAC[6] || tempAC_s==arAC[7]){Rang[2,4]=1;}
  
  if (Rang[2,0]==0 && Rang[2,1]==0 && Rang[2,3]==0 && Rang[2,4]==0){Rang[2,2]=1;}
  //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //4)=========================================================DeMarker==================================================
  if (DeMarker=arDeMarker[0] && DeMarker=arDeMarker[1] && DeMarker=arDeMarker[2] && DeMarker=arDeMarker[3] && DeMarker=arDeMarker[4] && DeMarker=arDeMarker[5] && DeMarker=arDeMarker[6] && DeMarker=arDeMarker[7]){Rang[3,4]=1;}
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  //5)==========================================================RSI======================================================
  if (RSI=arRSI[0] && RSI=arRSI[1] && RSI=arRSI[2] && RSI=arRSI[3] && RSI=arRSI[4] && RSI=arRSI[5] && RSI=arRSI[6] && RSI=arRSI[7]){Rang[4,4]=1;}
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //________________________________________________________________
""
还没有人打赏,支持一下

评论|共 25 个

博信黄金

发表于 2012-11-22 00:05:51 | 显示全部楼层

谢谢分享了!  

iboomer

发表于 2012-11-22 00:05:51 | 显示全部楼层

(*^__^*) 嘻嘻……   

与你同行

发表于 2012-11-22 00:05:51 | 显示全部楼层

帮你顶,人还是厚道点好  

晕了我呀

发表于 2012-11-22 00:05:51 | 显示全部楼层

我该不会是最后一个顶的吧  

老张

发表于 2012-11-22 00:05:51 | 显示全部楼层

这贴?不回都不行啊  

阳光小虾

发表于 2012-11-22 00:05:51 | 显示全部楼层

这个贴好像之前没见过  

nawoyo

发表于 2014-11-3 14:45:19 | 显示全部楼层

下了  的确不错

月芽儿

发表于 2014-11-3 16:06:00 | 显示全部楼层

没有使用说明书

lvdougao

发表于 2014-11-3 21:47:08 | 显示全部楼层

看看什么EA,,,

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

EA之家评论守则