论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:629回复:1
草龙
注册时间2004-12-17
[MT4指标]FibMark指标
楼主发表于:2014-03-18 09:07只看该作者倒序浏览
1楼 电梯直达
电梯直达
主图指标 mt4指标类型:震荡指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+------------------------------------------------------------------+ //| Double Fib Indicator | //| Copyright ? 2007, Wayne Ovenstone (FatCat) | //| http://www.ovenstone.net | //| Written by Mark Flexhaug for and on behalf of "The FatCat" | //+------------------------------------------------------------------+ #property copyright "Copyright ? 2007, The FatCat." #property link "http://www.ovenstone.net" #property indicator_chart_window #property indicator_buffers 7 #property indicator_color1 Black #property indicator_color2 Black #property indicator_color3 Black #property indicator_color4 Black #property indicator_color5 Black #property indicator_color6 Black #property indicator_color7 Black #property indicator_color8 Black //---- input parameters extern int nLeft=50; extern int nRight=50; extern int filter=10; extern color FirstColor = DodgerBlue, SecondColor = Gold; //---- buffers double UpBuffer; double DnBuffer; double f_2; double f_3; double f_4; double f_5; double f_6; //---- int draw_begin1=0, draw_begin2=0, d_b3=0; int init() { double nfUp; //---- indicators IndicatorBuffers(8); SetIndexStyle(0,DRAW_LINE,0,3); SetIndexStyle(1,DRAW_LINE,0,3); SetIndexStyle(2,DRAW_LINE,2); SetIndexStyle(3,DRAW_LINE,2); SetIndexStyle(4,DRAW_LINE,2); SetIndexStyle(5,DRAW_LINE,2); SetIndexStyle(6,DRAW_LINE,2); SetIndexBuffer(0,UpBuffer); SetIndexBuffer(1,DnBuffer); SetIndexBuffer(2,f_2); SetIndexBuffer(3,f_3); SetIndexBuffer(4,f_4); SetIndexBuffer(5,f_5); SetIndexBuffer(6,f_6); string short_name; short_name="rvmFractalsLevel("+nLeft+","+nRight+","+filter+")"; IndicatorShortName(short_name); SetIndexLabel(0,"Up Level ("+nLeft+","+nRight+","+filter+")"); SetIndexLabel(1,"Down Level ("+nLeft+","+nRight+","+filter+")"); SetIndexLabel(2,"f_2 ("+nLeft+","+nRight+","+filter+")"); SetIndexLabel(3,"f_3 ("+nLeft+","+nRight+","+filter+")"); SetIndexLabel(4,"f_4 ("+nLeft+","+nRight+","+filter+")"); SetIndexLabel(5,"f_5 ("+nLeft+","+nRight+","+filter+")"); SetIndexLabel(6,"f_6 ("+nLeft+","+nRight+","+filter+")"); int n,k,i,Range=nLeft+nRight+1; for(n=Bars-1-nLeft;n>=nRight;n--) { if(draw_begin1==0) { if(High[n]>=High[Highest(NULL,0,MODE_HIGH,Range,n-nRight)]) { int fRange=nvnLeft(n,nLeft)+nvnRight(n,nRight)+1; if(High[n]>=High[Highest(NULL,0,MODE_HIGH,fRange,n-nvnRight(n,nRight))]) { draw_begin1=Bars-n; for(i=Bars-1;i>draw_begin1;i--) { UpBuffer=High[Bars-draw_begin1]; } } }// if(High[n]>=High[Highest(NULL,0,MODE_HIGH,Range,n-nRight) }// if(draw_begin1==0) if(draw_begin2==0) { if(Low[n]<=Low[Lowest(NULL,0,MODE_LOW,Range,n-nRight)]) { fRange=nvnLeft(n,nLeft)+nvnRight(n,nRight)+1; if(Low[n]<=Low[Lowest(NULL,0,MODE_HIGH,fRange,n-nvnRight(n,nRight))]) { draw_begin2=Bars-n; for(i=Bars-1;i>draw_begin2;i--) { DnBuffer=Low[Bars-draw_begin2]; } } }// if(Low[n]<=Low[Lowest(NULL,0,MODE_LOW,Range,n-nRight)])=true }// if(draw_begin2==0) // for(n=Bars-1-nLeft;n>=nRight;n--) if(draw_begin1>0&&draw_begin2>0) break; }// for(n=Bars-1-nLeft;n>=nRight;n--) if(draw_begin1>draw_begin2) { d_b3=draw_begin1; } else { d_b3=draw_begin2; } SetIndexDrawBegin(0,draw_begin1); SetIndexDrawBegin(1,draw_begin2); SetIndexDrawBegin(2,d_b3); SetIndexDrawBegin(3,d_b3); SetIndexDrawBegin(4,d_b3); SetIndexDrawBegin(5,d_b3); SetIndexDrawBegin(6,d_b3); //---- return(0); } int start() { double UpStage=0.0,DnStage=0.0; int i,j,fRange,Range=nLeft+nRight+1; int counted_bars=IndicatorCounted(); //---- //(Bars-counted_bars-nLeft) (nRight) for(i=Bars-1-counted_bars-nLeft;i>=nRight;i--) { if(High>=High[Highest(NULL,0,MODE_HIGH,Range,i-nRight)]) { //Print(TimeToStr(Time), "******祟赅朦睇? 爨犟桁箪"); fRange=nvnLeft(i,nLeft)+nvnRight(i,nRight)+1; if(High>=High[Highest(NULL,0,MODE_HIGH,fRange,i-nvnRight(i,nRight))]) { UpStage=High; } else { if(High<=UpBuffer[i+1]) { UpStage=UpBuffer[i+1]; } else { UpStage=nfUp(i); } } } else { //Print(TimeToStr(Time), "******礤 腩赅朦睇? 爨犟桁箪"); if(High<=UpBuffer[i+1]) { UpStage=UpBuffer[i+1]; } else { UpStage=nfUp(i); } } if(Low<=Low[Lowest(NULL,0,MODE_LOW,Range,i-nRight)]) { fRange=nvnLeft(i,nLeft)+nvnRight(i,nRight)+1; //Print(TimeToStr(Time)," ",nvnLeft(i,nLeft)," ",nvnRight(i,nRight)+1); //羼腓 铐? 驽 - 麴嚓蜞? if(Low<=Low[Lowest(NULL,0,MODE_HIGH,fRange,i-nvnRight(i,nRight))]) { DnStage=Low; } else { if(Low>=DnBuffer[i+1]) { DnStage=DnBuffer[i+1]; } else { DnStage=nfDn(i); } } } else { if(Low>=DnBuffer[i+1]) { DnStage=DnBuffer[i+1]; } else { DnStage=nfDn(i); } } UpBuffer=UpStage; DnBuffer=DnStage; f_2=NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)/6,4); f_3=NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)/3,4); f_4=NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)/2,4); f_5=NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)*2/3,4); f_6=NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)*5/6,4); }// for(i=Bars-counted_bars-nLeft;i>=nRight;i--) for(i=nRight-1;i>=0;i--) { if(High<=UpBuffer[i+1]) { UpStage=UpBuffer[i+1]; } else { UpStage=nfUp(i); } if(Low>=DnBuffer[i+1]) { DnStage=DnBuffer[i+1]; } else { DnStage=nfDn(i); } UpBuffer=UpStage; DnBuffer=DnStage; f_2 =NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)/6,4); f_3 =NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)/3,4); f_4 =NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)/2,4); f_5 =NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)*2/3,4); f_6 =NormalizeDouble(DnBuffer+(UpBuffer-DnBuffer)*5/6,4); } double LastUp, LastDn, st_h, st_l, st_3, y1, y2, y3; int tmp, x1=0, x2=0, x3=0, cb, dn_x, up_x; string fibo="Fibo 1", fibo2="Fibo 2"; LastDn=DnBuffer[0]; for(cb=1;cb<=Bars-1;cb++) { if(tmp!=1 && LastDn>DnBuffer[cb]) { tmp=1; continue; } if(tmp==1 && DnBuffer[cb]>DnBuffer[cb-1]) { tmp=0; dn_x=cb-1; break; } } LastUp=UpBuffer[0]; for(cb=1;cb<=Bars-1;cb++) { if(tmp!=1 && LastUp=0;cb--) { if(High[cb]==st_h || Low[cb]==st_l) { if(High[cb]==st_h && (x1==0 || x2==0) ) { if(x1==0) { x1=cb; y1=High[x1]; continue; } else { x2=cb; y2=High[x2]; break; } } else { if(x1==0) { x1=cb; y1=Low[x1]; continue; } else { x2=cb; y2=Low[x2]; break; } } } } //Print("x1="+x1+" y1="+y1+" x2="+x2+" y2="+y2); if( ObjectFind(fibo)!=-1 ) { ObjectSet(fibo,OBJPROP_TIME1,Time[x1]); ObjectSet(fibo,OBJPROP_PRICE1,y1); ObjectSet(fibo,OBJPROP_TIME2,Time[x2]); ObjectSet(fibo,OBJPROP_PRICE2,y2); ObjectSet(fibo,OBJPROP_LEVELCOLOR,FirstColor); } else { ObjectCreate(fibo,OBJ_FIBO,0,Time[x1],y1,Time[x2],y2); ObjectSet(fibo,OBJPROP_COLOR,FirstColor); ObjectSet(fibo,OBJPROP_STYLE,STYLE_DOT); ObjectSet(fibo,OBJPROP_LEVELCOLOR,FirstColor); } if(y2>y1) { st_3=Low[Lowest(NULL,0,MODE_LOW,x2,0)]; } else { st_3=High[Highest(NULL,0,MODE_HIGH,x2,0)]; } for(cb=0;cby1 && Low[cb]==st_3) { x3=cb; y3=Low[cb]; break; } else { if(y20) { if(Close<=UpBuffer[l]+(UpBuffer[l]-DnBuffer[l])*filter/100) { Price=UpBuffer[l]; flag=1; //Print(TimeToStr(Time)," ",l," ",Bars," ",Price," ",UpBuffer[l]); } } else { if(High<=UpBuffer[l]) { Price=UpBuffer[l]; flag=1; } } if(Price>0) break; } if(flag==0) Price=High; //---------- return(Price); } //+------------------------------------------------------------------+ //****************************************************************************// double nfDn(int i) { int l,flag=0; double Price=0.0; //---------- for(l=i+1;l0) { if(Close>=DnBuffer[l]-(UpBuffer[l]-DnBuffer[l])*filter/100) { Price=DnBuffer[l]; flag=1; } } else { if(Low>=DnBuffer[l]) { Price=DnBuffer[l]; flag=1; } } if(Price>0) break; } if(flag==0) Price=Low; //---------- return(Price); } //+------------------------------------------------------------------+ //*****************************************************************************************// int nvnLeft(int i,int n) { int k=0,l; for(l=i+1;l<=Bars-1;l++) { if(High[l]Low[l+1]) continue; k++; if(k==n) { k=l-i; break; } } //---------- return(k); } //+------------------------------------------------------------------+ //*****************************************************************************************// int nvnRight(int i,int n) { int k=0,l; for(l=i-1;l>=0;l--) { if(High[l]Low[l+1]) continue; k++; if(k==n) { k=i-l; break; } } //---------- return(k); } int deinit() { //---- string fibo="Fibo 1", fibo2="Fibo 2"; ObjectDelete(fibo); ObjectDelete(fibo2); //---- return(0); } FibMark.jpgFibMark.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
Pzxzx
注册时间2017-08-06
发表于:2017-08-10 00:59只看该作者
2楼
韬客交易社区-国内最大的外汇交易社区

本站免责声明:

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

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

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

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

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

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