顺水外汇EA交易网MT4
标题:
本论坛下载的BBmacd报错不可用,高手给看看
[打印本页]
作者:
linghuchong007
时间:
2018-1-11 13:36
标题:
本论坛下载的BBmacd报错不可用,高手给看看
#property copyright "520FX 程序化策略交流社区"
#property link "http://www.520FX.com"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Gold
#property indicator_color2 Gold
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_style1 STYLE_DASH
#property indicator_style2 STYLE_DASH
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_level1 0
#property indicator_levelcolor MediumOrchid
//
//
//
//
//
extern int Length = 21;
extern bool drawDots = true;
extern int price = PRICE_MEDIAN;
extern double filter = 1;
extern double cyclesFast = 5.0;
extern double cyclesSlow = 10.0;
extern int devLength = 20;
extern bool UseClassicalDeviations = false;
extern double StDv = 2.0;
//
//
//
//
//
double buffer1[];
double buffer2[];
double bbMacd[];
double buffer4[];
double buffer5[];
double buffer6[];
double emaFast[];
double emaSlow[];
double alphas[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{DrawLogo();//加载Logo
IndicatorBuffers(8);
SetIndexBuffer(0, buffer1);
SetIndexBuffer(1, buffer2);
SetIndexBuffer(2, bbMacd);
SetIndexBuffer(3, buffer4);
SetIndexBuffer(4, buffer5);
SetIndexBuffer(5, buffer6);
SetIndexBuffer(6, emaFast);
SetIndexBuffer(7, emaSlow);
if (drawDots) {
SetIndexStyle(2, DRAW_ARROW); SetIndexArrow(2, 159);
SetIndexStyle(3, DRAW_ARROW); SetIndexArrow(3, 159);
SetIndexStyle(4, DRAW_NONE);
}
else
{
SetIndexStyle(2, DRAW_LINE);
SetIndexStyle(3, DRAW_LINE);
SetIndexStyle(4, DRAW_LINE);
}
//
//
//
//
//
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
IndicatorShortName("pa nonlag bbmacd ("+DoubleToStr(cyclesFast,2)+","+DoubleToStr(cyclesSlow,2)+","+DoubleToStr(filter,2)+")");
SetIndexLabel(0, "Upperband");
SetIndexLabel(1, "Lowerband");
SetIndexLabel(2, "BB Macd");
SetIndexLabel(3, NULL);
SetIndexLabel(4, NULL);
return(0);
}
int deinit(){DeleteLogo();//删除Logo return(0);}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
int limit,i;
if(counted_bars0) counted_bars--;
limit = Bars - counted_bars;
if (!drawDots)
if (bbMacd[limit][b]= 0 ; i--)
{
double prc = iNoLagMa(iMA(NULL,0,1,0,MODE_SMA,PRICE_MEDIAN,i),Length,alphas,0,i);
if (i==Bars-1)
{
emaFast[i] = prc;
emaSlow[i] = prc;
continue;
}
//
//
//
//
//
double alphaFast = 2.0/(1.0+iHilbertPhase(prc,filter,cyclesFast,i,0));
double alphaSlow = 2.0/(1.0+iHilbertPhase(prc,filter,cyclesSlow,i,1));
emaFast[i] = emaFast[i+1]+alphaFast*(prc-emaFast[i+1]);
emaSlow[i] = emaSlow[i+1]+alphaSlow*(prc-emaSlow[i+1]);
bbMacd[i] = emaFast[i]-emaSlow[i];
buffer6[i] = buffer6[i+1] + alpha*(bbMacd[i]-buffer6[i+1]);
double sDev = iDeviationPlus(bbMacd, buffer6, devLength, i);
buffer1[i] = buffer6[i] + (StDv * sDev);
buffer2[i] = buffer6[i] - (StDv * sDev);
buffer4[i] = EMPTY_VALUE;
buffer5[i] = EMPTY_VALUE;
//
//
//
//
//
if (bbMacd[i][b]0)
{
int len = values[forValue][_len];
double sum = 0;
for (k=0; k 0)
workHil[r][s+_phase] = 180.0/Pi*MathArctan(MathAbs(workHil[r][s+_Q1]/workHil[r][s+_I1]));
if (workHil[r][s+_I1]0) workHil[r][s+_phase] = 180-workHil[r][s+_phase];
if (workHil[r][s+_I1]0 && workHil[r][s+_Q1]270)
workHil[r][s+_deltaPhase] = 360+workHil[r-1][s+_phase]-workHil[r][s+_phase];
workHil[r][s+_deltaPhase] = MathMax(MathMin(workHil[r][s+_deltaPhase],60),7);
//
//
//
//
//
double alpha = 2.0/(1.0+MathMax(filter,1));
double phaseSum = 0; for (int k=0; phaseSum0; k++) phaseSum += workHil[r-k][s+_deltaPhase];
if (k>0) workHil[r][s+_instPeriod]= k;
workHil[r][s+_period] = workHil[r-1][s+_period]+alpha*(workHil[r][s+_instPeriod]-workHil[r-1][s+_period]);
return (workHil[r][s+_period]);
}
//
//
//
//
//
double calcComp(int r, int from, int s)
{
return((0.0962*workHil[r ][s+from] +
0.5769*workHil[r-2][s+from] -
0.5769*workHil[r-4][s+from] -
0.0962*workHil[r-6][s+from]) * (0.075*workHil[r-1][s+_period] + 0.54));
}
void writetext(string Labelname,string data,int x,int y,int Corner,color ColorValue,int FontSize)//通过Object写文字
{
ObjectDelete(Labelname);
ObjectCreate(Labelname, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Labelname, data, FontSize, "Arial", ColorValue);
ObjectSet(Labelname, OBJPROP_CORNER, 0);
ObjectSet(Labelname, OBJPROP_CORNER,Corner);
ObjectSet(Labelname, OBJPROP_XDISTANCE, x);
ObjectSet(Labelname, OBJPROP_YDISTANCE, y);
}
void DrawLogo()
{
int Corner=2;
int x=10;
int y=10;
color ColorValue=White;
color LogoColor=Yellow;
writetext("左下角","┗",0+x,0+y,Corner,ColorValue,10);
for(int i=0;i<=10;i++)
writetext("上横线"+i,"━",9+x+i*13,0+y,Corner,ColorValue,10);
writetext("右下角","┛",0+x+i*13+9,0+y,Corner,ColorValue,10);
for(int j=0;j<=1;j++)
writetext("左竖线"+j,"|",0+x,14+y+j*13,Corner,ColorValue,10);
for(j=0;j<=1;j++)
writetext("左竖线1"+j,"|",0+x+1,14+y+j*13,Corner,ColorValue,10);
writetext("左上角","┏",0+x,14+y+j*13,Corner,ColorValue,10);
writetext("文字1","www.520FX.com",35+x,10+y,Corner,LogoColor,10);
writetext("文字2","程序交易策略社区",20+x,25+y,Corner,ColorValue,10);
for(int k=0;k<=10;k++)
writetext("下横线"+k,"━",9+x+k*13,14+y+j*13,Corner,ColorValue,10);
writetext("右上角","┓",9+x+k*13,14+y+j*13,Corner,ColorValue,10);
for(int r=0;r<=1;r++)
writetext("右竖线"+r,"|",9+x+k*13,14+y+(j-(r+1))*13,Corner,ColorValue,10);
for(r=0;r<=1;r++)
writetext("右竖线1"+r,"|",9+x+k*13+1,14+y+(j-(r+1))*13,Corner,ColorValue,10);
}
void DeleteLogo()
{
ObjectDelete("左下角");
for(int i=0;i<=10;i++)
ObjectDelete("上横线"+i);
ObjectDelete("右下角");
for(int j=0;j<=1;j++)
ObjectDelete("左竖线"+j);
for(j=0;j<=1;j++)
ObjectDelete("左竖线1"+j);
ObjectDelete("左上角");
ObjectDelete("文字1");
ObjectDelete("文字2");
for(int k=0;k<=10;k++)
ObjectDelete("下横线"+k);
ObjectDelete("右上角");
for(int r=0;r<=1;r++)
ObjectDelete("右竖线"+r);
for(r=0;r<=1;r++)
ObjectDelete("右竖线1"+r);
}
作者:
951
时间:
2018-1-11 13:59
楼主补个图片嘛。。。
作者:
taiji55
时间:
2018-1-11 15:16
520有你更精彩
获取投资智慧 分享投资快乐
作者:
15336221510
时间:
2018-1-11 15:32
666666
作者:
xinge714
时间:
2018-1-11 15:58
6666666666
作者:
mtwspczh
时间:
2018-1-11 16:59
这个版本5个indexbuffer的没看过,如果不挑,直接在 http://www.520fx.com/thread-37758-1-1.html 下一个吧
作者:
temp111111
时间:
2018-1-11 18:03
WVFWVFWVFWVFWVFWVFWVFWVFWVFWVFWVFWVFWVFggg
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2