EA KAMA4.1 Advanced

EA KAMA4.1 Advanced最新版

官方版无广告137

更新日期:2022-03-03分类标签: 语言:中文平台:没限制

14 人已下载 手机查看

//+——————————————————————+
//| MA_BBands_V3.2.mq4 |
//| Copyright 2005-2014, MetaQuotes Software Corp. |
//| http://www.mql4.com |
//| E-MAIL:40468962@qq.com |
//+——————————————————————+
//#property copyright “2005-2020, MetaQuotes Software Corp.”
#property copyright “E-MAIL: 40468962@qq.com”
#property link “http://www.mql4.com”

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Blue
#property indicator_color3 Red

#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 3

//————————-
extern int MAPeriod = 16 ;
extern double MA_Deviation = 0.07; //0.1
extern int move_shift = 40;
extern int SmoothPeriod = 10 ;

extern double Std = 1.0 ; //1.5;2.0
extern int BPeriod = 50 ;
extern int Dist = 5 ;

extern int kama_period = 10;
extern double fast_ma_period = 2.0;
extern double slow_ma_period = 30.0;
//————————-

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
double ExtMapBuffer9[];
double ExtMapBuffer10[];
double ExtMapBuffer11[];
double ExtMapBuffer12[];
double ExtMapBuffer13[];
double ExtMapBuffer14[];
double ExtMapBuffer15[];
double ExtMapBuffer16[];
double ExtMapBuffer17[];
double ExtMapBuffer18[];
double ExtMapBuffer19[];
double ExtMapBuffer20[];
double ExtMapBuffer21[];

double Get_Point;
//——————-

int init()
{

IndicatorBuffers(21);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer19);
SetIndexShift(0,1);

SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer20);
SetIndexShift(1,1);

SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer21);
SetIndexShift(2,1);

SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer1);

SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,ExtMapBuffer2);

SetIndexStyle(5,DRAW_LINE);
SetIndexBuffer(5,ExtMapBuffer3);

SetIndexStyle(6,DRAW_LINE);
SetIndexBuffer(6,ExtMapBuffer4);

SetIndexStyle(7,DRAW_LINE);
SetIndexBuffer(7,ExtMapBuffer5);

SetIndexStyle(8,DRAW_LINE);
SetIndexBuffer(8,ExtMapBuffer6);

SetIndexStyle(9,DRAW_LINE);
SetIndexBuffer(9,ExtMapBuffer7);

SetIndexStyle(10,DRAW_LINE);
SetIndexBuffer(10,ExtMapBuffer8);

SetIndexStyle(11,DRAW_LINE);
SetIndexBuffer(11,ExtMapBuffer9);

SetIndexStyle(12,DRAW_LINE);
SetIndexBuffer(12,ExtMapBuffer10);

SetIndexStyle(13,DRAW_LINE);
SetIndexBuffer(13,ExtMapBuffer11);

SetIndexStyle(14,DRAW_LINE);
SetIndexBuffer(14,ExtMapBuffer12);

SetIndexStyle(15,DRAW_LINE);
SetIndexBuffer(15,ExtMapBuffer13);

SetIndexStyle(16,DRAW_LINE);
SetIndexBuffer(16,ExtMapBuffer14);

SetIndexStyle(17,DRAW_LINE);
SetIndexBuffer(17,ExtMapBuffer15);

SetIndexStyle(18,DRAW_LINE);
SetIndexBuffer(18,ExtMapBuffer16);

SetIndexStyle(19,DRAW_LINE);
SetIndexBuffer(19,ExtMapBuffer17);

SetIndexStyle(20,DRAW_LINE);
SetIndexBuffer(20,ExtMapBuffer18);

if(Digits==3 || Digits==5) Get_Point= 10*Point;
else
{
Get_Point= Point;
if(Symbol()== “XAUUSD” ) { Get_Point= 10*Point; }
}

return(0);
}
//—————————————-

int deinit()
{

ObjectDelete(“a label”);
return(0);

}
//—————————————-
int start()
{

int TextSize=20;
color TextColor1 = Magenta ;

if(ObjectFind(“a label”) != 0)
{
ObjectCreate(“a label”, OBJ_LABEL, 0,0,0);
ObjectSetText(“a label”,”Advanced_KAMA4.1 ” , TextSize, “Arial”, TextColor1);
ObjectSet(“a label”, OBJPROP_XDISTANCE,400);
ObjectSet(“a label”, OBJPROP_YDISTANCE,0);
}

int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars–;
int limit=Bars-counted_bars;

double fastest = 2 / (fast_ma_period + 1);
double slowest = 2 / (slow_ma_period + 1);

for(int i=limit; i>=1; i–)
{

WindowRedraw();
RefreshRates();

double MAUP1 = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,-move_shift,PRICE_HIGH,MA_Deviation,MODE_UPPER,i);
double BB_UP = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,0,PRICE_HIGH,MA_Deviation,MODE_UPPER,i);

double MADN1 = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,-move_shift,PRICE_LOW,MA_Deviation,MODE_LOWER,i);
double BB_DN = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,0,PRICE_LOW,MA_Deviation,MODE_LOWER,i);
//————————
double MAUP2 = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,-20,PRICE_HIGH,MA_Deviation,MODE_UPPER,i);
double BB_UP2 = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,0,PRICE_HIGH,MA_Deviation,MODE_UPPER,i);

double MADN2 = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,-20,PRICE_LOW,MA_Deviation,MODE_LOWER,i);
double BB_DN2 = iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,0,PRICE_LOW,MA_Deviation,MODE_LOWER,i);

//——————————————————————–
if (MAUP1>BB_UP) {ExtMapBuffer1[i]=MAUP1; BB_UP=EMPTY_VALUE ;}
else {ExtMapBuffer1[i]=BB_UP ; MAUP1=EMPTY_VALUE ;}

if( MADN1 >0.0 )
{
if ( MADN1<BB_DN) {ExtMapBuffer2[i]=MADN1; BB_DN=EMPTY_VALUE ;}
else { ExtMapBuffer2[i]=BB_DN ; MADN1=EMPTY_VALUE ; }
}

if (MADN1 ==0.0 ) { ExtMapBuffer2[i]=BB_DN; MADN1=EMPTY_VALUE ;}
//————————————————————
if (MAUP2>BB_UP2) {ExtMapBuffer3[i]=MAUP2; BB_UP2=EMPTY_VALUE ;}
else {ExtMapBuffer3[i]=BB_UP2 ; MAUP2=EMPTY_VALUE ;}

if( MADN2 >0.0 )
{
if ( MADN2<BB_DN2) {ExtMapBuffer4[i]=MADN2; BB_DN2=EMPTY_VALUE ;}
else { ExtMapBuffer4[i]=BB_DN2 ; MADN2=EMPTY_VALUE ; }
}

if (MADN2 ==0.0 ) { ExtMapBuffer4[i]=BB_DN2; MADN2=EMPTY_VALUE ;}
//————————————————————
if(ExtMapBuffer1[i]>ExtMapBuffer3[i]) { ExtMapBuffer5[i]=ExtMapBuffer1[i]; } else { ExtMapBuffer5[i]=ExtMapBuffer3[i]; }
if(ExtMapBuffer2[i]<ExtMapBuffer4[i]) { ExtMapBuffer6[i]=ExtMapBuffer2[i]; } else { ExtMapBuffer6[i]=ExtMapBuffer4[i]; }

ExtMapBuffer7[i]= iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,-move_shift,PRICE_HIGH,MA_Deviation,MODE_UPPER,i);
ExtMapBuffer8[i]= iEnvelopes(NULL,0,MAPeriod,MODE_SMMA,-move_shift,PRICE_LOW,MA_Deviation,MODE_LOWER,i);

if(ExtMapBuffer7[i]==0.0) ExtMapBuffer7[i]=ExtMapBuffer7[i+1];
if(ExtMapBuffer8[i]==0.0) ExtMapBuffer8[i]=ExtMapBuffer8[i+1];

if(ExtMapBuffer5[i]>ExtMapBuffer7[i]) { ExtMapBuffer9[i]=ExtMapBuffer5[i]; } else { ExtMapBuffer9[i]=ExtMapBuffer7[i]; }
if(ExtMapBuffer6[i]<ExtMapBuffer8[i]) { ExtMapBuffer10[i]=ExtMapBuffer6[i]; } else { ExtMapBuffer10[i]=ExtMapBuffer8[i]; }

ExtMapBuffer11[i]= iMAOnArray(ExtMapBuffer9,Bars-1,SmoothPeriod,0,MODE_SMA,i);
ExtMapBuffer12[i]= iMAOnArray(ExtMapBuffer10,Bars-1,SmoothPeriod,0,MODE_SMA,i);

//————————————————————
// KAMA
//————————————————————

double er = 1;
double signal = MathAbs(ExtMapBuffer11[i] – ExtMapBuffer11[i+kama_period]);
double noise = 0;
for (int j=0; j<kama_period; j++)
noise += MathAbs(ExtMapBuffer11[i+j] – ExtMapBuffer11[i+j+1]);
if (noise > 0)
er = signal / noise;
double sc = MathPow((er * (fastest – slowest) + slowest), 2);
ExtMapBuffer13[i] = ExtMapBuffer13[i+1] + sc * (ExtMapBuffer11[i] – ExtMapBuffer13[i+1]);
//———————–
double er2 = 1;
double signal2 = MathAbs(ExtMapBuffer12[i] – ExtMapBuffer12[i+kama_period]);
double noise2 = 0;
for (j=0; j<kama_period; j++)
noise2 += MathAbs(ExtMapBuffer12[i+j] – ExtMapBuffer12[i+j+1]);

if (noise2 > 0)
er2 = signal2 / noise2;

double sc2 = MathPow((er * (fastest – slowest) + slowest), 2);
ExtMapBuffer14[i] = ExtMapBuffer14[i+1] + sc2 * (ExtMapBuffer12[i] – ExtMapBuffer14[i+1]);
//——————–
//——————–
if(ExtMapBuffer11[i]>ExtMapBuffer13[i]) {ExtMapBuffer15[i]= ExtMapBuffer11[i]+Dist*Get_Point; } else {ExtMapBuffer15[i]= ExtMapBuffer13[i]+Dist*Get_Point; }
if(ExtMapBuffer12[i]<ExtMapBuffer14[i]) {ExtMapBuffer16[i]= ExtMapBuffer12[i]; } else {ExtMapBuffer16[i]= ExtMapBuffer14[i]; }

//————————————————————

ExtMapBuffer17[i]= iBands(NULL,0,BPeriod,Std,0,PRICE_HIGH,MODE_UPPER,i);
ExtMapBuffer18[i]= iBands(NULL,0,BPeriod,Std,0,PRICE_LOW ,MODE_LOWER,i);

//————————————————————

if(ExtMapBuffer15[i]>ExtMapBuffer17[i]) {ExtMapBuffer19[i]= ExtMapBuffer15[i]; } else {ExtMapBuffer19[i]= ExtMapBuffer17[i]; }
if(ExtMapBuffer16[i]<ExtMapBuffer18[i]) {ExtMapBuffer20[i]= ExtMapBuffer16[i]; } else {ExtMapBuffer20[i]= ExtMapBuffer18[i]; }

ExtMapBuffer21[i]=NormalizeDouble((ExtMapBuffer19[i]+ExtMapBuffer20[i])/2.0,Digits) ;

}

WindowRedraw();
RefreshRates();

return(0);

}
//——————————–

 

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

暂无评论...
Ads Blocker Image Powered by Code Help Pro

检测到广告拦截程序!!!Ads Blocker Detected!!!

我们检测到您正在使用扩展来屏蔽广告。请通过禁用这些广告屏蔽程序或者把网站加入白名单来支持我们。

We have detected that you are using an extension to block advertisements. Please support us by disabling these advertising blocking programs or adding the website to the whitelist.