模糊逻辑交易程序原代码
模糊逻辑交易程序原代码/* 模糊逻辑交易程序原代码。仅供学习之用,在实际交易中使用后果自负。*/
//+------------------------------------------------------------------+
//| _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 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){Rang=1;}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//2)========================================================WPR=======================================================
if (WPR=arWPR && WPR=arWPR && WPR=arWPR && WPR=arWPR && WPR=arWPR && WPR=arWPR && WPR=arWPR && WPR=arWPR){Rang=1;}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//3)============================================================AC=====================================================
if (AC10){tempAC_s=5;}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (tempAC_b==arAC || tempAC_b==arAC){Rang=1;}
if (tempAC_b==arAC || tempAC_b==arAC){Rang=1;}
if (tempAC_s==arAC || tempAC_s==arAC){Rang=1;}
if (tempAC_s==arAC || tempAC_s==arAC){Rang=1;}
if (Rang==0 && Rang==0 && Rang==0 && Rang==0){Rang=1;}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//4)=========================================================DeMarker==================================================
if (DeMarker=arDeMarker && DeMarker=arDeMarker && DeMarker=arDeMarker && DeMarker=arDeMarker && DeMarker=arDeMarker && DeMarker=arDeMarker && DeMarker=arDeMarker && DeMarker=arDeMarker){Rang=1;}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//5)==========================================================RSI======================================================
if (RSI=arRSI && RSI=arRSI && RSI=arRSI && RSI=arRSI && RSI=arRSI && RSI=arRSI && RSI=arRSI && RSI=arRSI){Rang=1;}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//________________________________________________________________ 谢谢分享了! (*^__^*) 嘻嘻…… 帮你顶,人还是厚道点好 我该不会是最后一个顶的吧 这贴?不回都不行啊 这个贴好像之前没见过 下了的确不错 没有使用说明书 看看什么EA,,,