论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:599回复:0
草龙
注册时间2004-12-17
[MT4指标]Borders通道指标
楼主发表于:2014-02-10 16:43只看该作者倒序浏览
1楼 电梯直达
电梯直达
主图指标 Borders通道指标 mt4指标类型:震荡指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+------------------------------------------------------------------+ //| Borders.mq4 | //| "韧娜世椅雄 乃? 牙涛瘟汤屠" | //| Bookkeeper, 2006, [email protected] | //+------------------------------------------------------------------+ #property copyright "" #property link "" //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 7 #property indicator_color1 Olive #property indicator_color2 Olive #property indicator_color3 Olive #property indicator_color4 Olive #property indicator_color5 PowderBlue #property indicator_color6 PowderBlue #property indicator_color7 Yellow //---- extern int MaxPeriod =60; extern int MinPeriod =24; extern bool Show_MaxPeriod =true; // 需耦忄螯 觐痂漕? 镱 疋鬻赅? // ? 镥痂钿铎 MaxPeriod extern bool Show_HistMaxPeriod =true; // 需耦忄螯 觐痂漕? 镱 疋鬻赅? // ? 镥痂钿铎 MaxPeriod // ? 忤溴 汨耱钽疣祆? extern bool Show_HistMinPeriod =true; // 需耦忄螯 觐痂漕? 镱 疋鬻赅? // ? 镥痂钿铎 MinPeriod // ? 忤溴 汨耱钽疣祆? extern bool Show_Signal =true; // 需耦忄螯 耔沩嚯 簋 //---- double TopBorder1; double ind_buffer1; double BottomBorder1; double ind_buffer2; double TopBorder2; double BottomBorder2; double Signal; //---- double Snake_Sum, Snake_Weight, Snake_Sum_Minus, Snake_Sum_Plus; double indperiod,val1,val2; string CommentStr; //---- int init() { int draw_begin; draw_begin=2*MaxPeriod+10; IndicatorBuffers(7); SetIndexBuffer(0,TopBorder1); SetIndexBuffer(1,ind_buffer1); SetIndexBuffer(2,BottomBorder1); SetIndexBuffer(3,ind_buffer2); SetIndexBuffer(4,TopBorder2); SetIndexBuffer(5,BottomBorder2); SetIndexBuffer(6,Signal); if(Show_MaxPeriod==true) { if(Show_HistMaxPeriod==true) { SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2); SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2); SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,2); SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,2); } else { SetIndexStyle(0,DRAW_LINE,EMPTY,2); SetIndexStyle(1,DRAW_NONE); SetIndexStyle(2,DRAW_LINE,EMPTY,2); SetIndexStyle(3,DRAW_NONE); } } else { SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_NONE); SetIndexStyle(2,DRAW_NONE); SetIndexStyle(3,DRAW_NONE); } if(Show_HistMinPeriod==true) { SetIndexStyle(4,DRAW_HISTOGRAM); SetIndexStyle(5,DRAW_HISTOGRAM); } else { SetIndexStyle(4,DRAW_LINE); SetIndexStyle(5,DRAW_LINE); } if(Show_Signal==true) SetIndexStyle(6,DRAW_LINE); else SetIndexStyle(6,DRAW_NONE); SetIndexDrawBegin(0,draw_begin); SetIndexDrawBegin(1,draw_begin); SetIndexDrawBegin(2,draw_begin); SetIndexDrawBegin(3,draw_begin); SetIndexDrawBegin(4,draw_begin); SetIndexDrawBegin(5,draw_begin); SetIndexDrawBegin(6,draw_begin); indperiod=1.0*MinPeriod*Period(); if(indperiod<60) { CommentStr=DoubleToStr(indperiod,0); CommentStr=" M"+CommentStr; } else { indperiod=indperiod/60; if(indperiod>=24) { val1=MathAbs(MathRound(indperiod/24)-indperiod/24); if(val1<0.01) { CommentStr=DoubleToStr(indperiod/24,0); CommentStr=" D"+CommentStr; } else { CommentStr=DoubleToStr(indperiod/24,1); CommentStr=" D"+CommentStr; } } else { val1=MathAbs(MathRound(indperiod)-indperiod); if(val1<0.01) { CommentStr=DoubleToStr(indperiod,0); CommentStr=" H"+CommentStr; } else { CommentStr=DoubleToStr(indperiod,1); CommentStr=" H"+CommentStr; } } } CommentStr="SnakeInBorders"+CommentStr; if(Show_MaxPeriod==true) { indperiod=1.0*MaxPeriod*Period(); if(indperiod<60) CommentStr=CommentStr+" in M"+DoubleToStr(indperiod,0); else { indperiod=indperiod/60; if(indperiod>=24) { val1=MathAbs(MathRound(indperiod/24)-indperiod/24); if(val1<0.01) CommentStr=CommentStr+" in D"+DoubleToStr(indperiod/24,0); else CommentStr=CommentStr+" in D"+DoubleToStr(indperiod/24,1); } else { val1=MathAbs(MathRound(indperiod)-indperiod); if(val1<0.01) CommentStr=CommentStr+" in H"+DoubleToStr(indperiod,0); else CommentStr=CommentStr+" in H"+DoubleToStr(indperiod,1); } } } return(0); } //---- void deinit() { Comment(""); } //---- int start() { int FirstPos, ExtCountedBars=0,i; if(Bars<=150) return(0); if(MinPeriod<21) return(0); if(MaxPeriod<=MinPeriod) return(0); ExtCountedBars=IndicatorCounted(); if (ExtCountedBars<0) return(-1); if (ExtCountedBars>0) ExtCountedBars--; FirstPos=Bars-ExtCountedBars-1; if(FirstPos>Bars-MaxPeriod-7) { FirstPos=Bars-MaxPeriod-7; Signal[FirstPos+MaxPeriod]=SnakeFirstCalc(FirstPos+MaxPeriod); for(i=FirstPos+MaxPeriod-1;i>FirstPos;i--) SnakeNextCalc(i); } Snake(FirstPos); return(0); } //---- void Snake(int Pos) { int i; if(Pos<6) Pos=6; Signal[Pos]=SnakeFirstCalc(Pos); Drawing(Pos); Pos--; while(Pos>=5) { Signal[Pos]=SnakeNextCalc(Pos); Drawing(Pos); Pos--; } while(Pos>0) { Signal[Pos]=SnakeFirstCalc(Pos); Drawing(Pos); Pos--; } if(Pos==0) { Signal[Pos]=iMA(NULL,0,6,0,MODE_LWMA,PRICE_TYPICAL,0); Drawing(Pos); } return; } //---- double SnakePrice(int Shift) { return((2*Close[Shift]+High[Shift]+Low[Shift])/4); } //---- double SnakeFirstCalc(int Shift) { int i, j, w; Snake_Sum=0.0; if(Shift<5) { Snake_Weight=0.0; i=0; w=Shift+5; while(w>=Shift) { i++; Snake_Sum=Snake_Sum+i*SnakePrice(w); Snake_Weight=Snake_Weight+i; w--; } while(w>=0) { i--; Snake_Sum=Snake_Sum+i*SnakePrice(w); Snake_Weight=Snake_Weight+i; w--; } } else { Snake_Sum_Minus=0.0; Snake_Sum_Plus=0.0; for(j=Shift-5,i=Shift+5,w=1; w<=5; j++,i--,w++) { Snake_Sum=Snake_Sum+w*(SnakePrice(i)+SnakePrice(j)); Snake_Sum_Minus=Snake_Sum_Minus+SnakePrice(i); Snake_Sum_Plus=Snake_Sum_Plus+SnakePrice(j); } Snake_Sum=Snake_Sum+6*SnakePrice(Shift); Snake_Sum_Minus=Snake_Sum_Minus+SnakePrice(Shift); Snake_Weight=36; } return(Snake_Sum/Snake_Weight); } //---- double SnakeNextCalc(int Shift) { Snake_Sum_Plus=Snake_Sum_Plus+SnakePrice(Shift-5); Snake_Sum=Snake_Sum-Snake_Sum_Minus+Snake_Sum_Plus; Snake_Sum_Minus=Snake_Sum_Minus-SnakePrice(Shift+6)+SnakePrice(Shift); Snake_Sum_Plus=Snake_Sum_Plus-SnakePrice(Shift); return(Snake_Sum/Snake_Weight); } //---- void Drawing(int Shift) { int i; TopBorder1[Shift]= (5*Signal[ArrayMaximum(Signal,MaxPeriod,Shift)]+4*Signal[Shift])/9; BottomBorder1[Shift]= (5*Signal[ArrayMinimum(Signal,MaxPeriod,Shift)]+4*Signal[Shift])/9; TopBorder2[Shift]= (5*Signal[ArrayMaximum(Signal,MinPeriod,Shift)]+4*Signal[Shift])/9; ind_buffer1[Shift]=TopBorder2[Shift]; BottomBorder2[Shift]= (5*Signal[ArrayMinimum(Signal,MinPeriod,Shift)]+4*Signal[Shift])/9; ind_buffer2[Shift]=BottomBorder2[Shift]; if(Shift==0) ind_comment(); return; } //---- void ind_comment() { string shortname,str; int i; shortname=CommentStr; str=DoubleToStr((TopBorder2[11]-BottomBorder2[11])/Point,0); shortname=shortname+" : Walk .."+str+"?"; for(i=10;i>=0;i--) { str=DoubleToStr((TopBorder2-BottomBorder2)/Point,0); shortname=shortname+".."+str+"?"; } Comment(shortname); return; } //---- Borders.jpgBorders.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

阅尽天下指标
搬砖开始,始于2014

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]