【ZIGFIBO_V5】判断趋势走向以及支撑阻力
指标名称:ZIGFIBO_V5 (ZFV5 )版本:MT4 ver. 5.01
ZIGFIBO_V5(ZFV5 ) 是一款结合 ZigZag 折线、斐波那契扩展工具、趋势线及实时监控功能的 MT4 技术指标。它能自动识别价格波动的高低点,并通过斐波那契扩展线、箭头信号和止损线辅助交易决策,适合趋势跟踪和支撑阻力分析。核心功能说明
1. ZigZag 折线
[*]自动标记价格的高点和低点,形成折线,帮助识别趋势反转点。
[*]注意:ZigZag 可能因新数据出现而重绘,建议结合其他指标确认信号。
2. 买入/卖出信号
[*]绿色箭头:在 ZigZag 低点后出现,提示潜在买入机会。
[*]品红箭头:在 ZigZag 高点后出现,提示潜在卖出机会。
[*]红色止损线:显示当前交易的止损位置。
3. 斐波那契扩展线基于 ZigZag 的三个连续转折点绘制,显示多个斐波那契水平(如 0.618、1.618),用于预测价格目标。4. 趋势线与 Pitchfork
[*]趋势线:连接历史高低点,辅助判断支撑阻力。
[*]Pitchfork:通过中线轨道提示价格可能的波动范围。
5. 实时监控面板右上角显示当前点差(Spread)和当前 K 线剩余时间,便于管理交易时机。使用示例
1. 趋势交易
[*]当 ZigZag 出现连续低点后,若绿色箭头出现且价格突破斐波那契 0.618 水平,可考虑买入。
[*]止损设在红色止损线下方,目标参考斐波那契 1.618 或 Pitchfork 上轨。
2. 支撑阻力交易价格接近趋势线或 Pitchfork 下轨时,若出现卖出箭头,可结合斐波那契扩展线做空。参数:指标计算参数nBArrowSize:指标计算柱数ZigZagBars:普通周期ZigZag柱数ZigZag图形参数ZigZagBarsM1:M1周期专用值LineZigZagWidth:ZigZag线宽LineZigZagColor:ZigZag线色ArrowSize:箭头尺寸LineWidth:信号线宽LineColorSell:卖出信号色LineColorBuy:买入信号色LineColorStopLoss:止损线色斐波那契参数ExtFiboExpansionColor:斐波线颜色ExtExpansionStyle:斐波线型ExtExpansionWidth:斐波线宽FiboExp:启用斐波扩展ShowArrow:显示箭头ShowHLine:显示水平线监控面板参数Clock_Color:信息颜色Corner:面板位置FontSize:字体大小XDISTANCE:水平偏移YDISTANCE:垂直偏移音叉线参数Pitchwork1:启用音叉类型1Pitchwork2:启用音叉类型2PitchWorkstyle:音叉1样式PitchWorksWIDTH:音叉1线宽clrPitchWorkBuy:买入音叉色clrPitchWorkSell:卖出音叉色PitchWorkstyle2:音叉2样式PitchWorksWIDTH2:音叉2线宽趋势线参数TreandLines1:启用趋势线1TreandLinesStyle1:趋势线1样式TreandLines1WIDTH:趋势线1宽TreandLines1clr:趋势线1颜色TreandLines2:启用趋势线2TreandLinesStyle2:趋势线2样式部分代码展示:
[*]
//+------------------------------------------------------------------+//| ZIGFIBO_V5 .mq4 |//| Copyright © 2009-2024, www.QChaos.com |//| https://www.qchaos.com/ |//+------------------------------------------------------------------+#property indicator_chart_window#property indicator_buffers 1
//------------------------------------------// 参数分组:指标计算设置//------------------------------------------extern string ______________0______________="指标计算所用柱数设置";// 分组标题extern int nBArrowSize =618; // 指标计算柱数
extern string ______________1______________="ZigZag计算柱数设置";// 分组标题extern int ZigZagBars =6; // 普通周期ZigZag计算柱数
//------------------------------------------// 参数分组:ZigZag图形设置//------------------------------------------extern string ______________2______________="M1周期ZigZag设置"; // 分组标题extern int ZigZagBarsM1 =15; // M1周期专用值(其他周期用6)extern int LineZigZagWidth =2; // ZigZag线宽度extern color LineZigZagColor =Blue; // ZigZag线颜色extern int ArrowSize =2; // 箭头大小extern int LineWidth =5; // 信号线宽度extern color LineColorSell =Magenta; // 卖出信号颜色extern color LineColorBuy =Green;// 买入信号颜色extern color LineColorStopLoss =Red; // 止损线颜色
//------------------------------------------// 参数分组:斐波那契扩展设置//------------------------------------------extern string ______________3______________="斐波那契扩展参数"; // 分组标题extern color ExtFiboExpansionColor =Olive; // 斐波那契线颜色extern int ExtExpansionStyle =2; // 斐波那契线型(0-4)extern int ExtExpansionWidth =0; // 斐波那契线宽extern bool FiboExp =true;// 启用斐波那契扩展extern bool ShowArrow =true;// 显示交易箭头extern bool ShowHLine =true;// 显示水平线
//------------------------------------------// 参数分组:监控面板设置//------------------------------------------extern string ______________4______________="监控面板参数"; // 分组标题extern color Clock_Color =DarkBlue; // 信息显示颜色extern stringCorner_Placement ="1为右上角 3为右下角"; // 位置说明extern int Corner =1; // 面板位置(1/3)extern int FontSize =10; // 字体大小extern int XDISTANCE =30; // 水平偏移量extern int YDISTANCE =30; // 垂直偏移量string objname ="Spread&Bar"; // 对象名称
//------------------------------------------// 参数分组:音叉线设置//------------------------------------------extern string ______________5______________="音叉线参数"; // 分组标题extern bool Pitchwork1 =true;// 启用音叉线类型1extern bool Pitchwork2 =true;// 启用音叉线类型2extern int PitchWorkstyle =2; // 音叉线1样式extern int PitchWorksWIDTH =1; // 音叉线1宽度extern color clrPitchWorkBuy =Green; // 买入音叉颜色extern color clrPitchWorkSell =Red; // 卖出音叉颜色extern int PitchWorkstyle2 =1; // 音叉线2样式extern int PitchWorksWIDTH2 =2; // 音叉线2宽度extern color clrPitchWorkBuy2 =Green; // 买入音叉2颜色extern color clrPitchWorkSell2 =Red; // 卖出音叉2颜色
//------------------------------------------// 参数分组:趋势线设置//------------------------------------------extern string ______________6______________="支撑阻力线参数"; // 分组标题extern bool TreandLines1 =true;// 启用趋势线1extern int TreandLinesStyle1 =3; // 趋势线1样式extern int TreandLines1WIDTH =3; // 趋势线1宽度extern color TreandLines1clr =clrTeal; // 趋势线1颜色extern bool TreandLines2 =true;// 启用趋势线2extern int TreandLinesStyle2 =3; // 趋势线2样式extern int TreandLines2WIDTH =3; // 趋势线2宽度extern color TreandLines2clr =clrPurple; // 趋势线2颜色
//+------------------------------------------------------------------+// 全局变量声明double SetArrowUp[],SetArrowDn[],EMB[];int shift;//+------------------------------------------------------------------+//+------------------------------------------------------------------+int init(){ SetIndexStyle(0,1,DRAW_SECTION,LineZigZagWidth,LineZigZagColor); SetIndexBuffer(0,EMB); SetIndexEmptyValue(0,0.0);//---- ObjectCreate(objname, OBJ_LABEL, 0, 0, 0); ObjectSet(objname, OBJPROP_CORNER, Corner); ObjectSet(objname, OBJPROP_XDISTANCE,XDISTANCE); ObjectSet(objname, OBJPROP_YDISTANCE,YDISTANCE);//---- return(0);}//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int deinit(){ ObjectDelete("Buy"); ObjectDelete("Sell"); ObjectDelete("Buy Line"); ObjectDelete("Sell Line"); ObjectDelete("StopLoss Buy"); ObjectDelete("StopLoss Sell"); ObjectDelete("Fibo1"); ObjectDelete("Fibo2"); ObjectDelete("PitchWorksBuy"); ObjectDelete("PitchWorksSell"); ObjectDelete("PitchWorksBuy2"); ObjectDelete("PitchWorksSell2"); ObjectDelete("TreandLines1"); ObjectDelete("TreandLines2"); ObjectDelete(objname); Comment(""); return(0);}//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int start(){ if(Period()==1) ZigZagBars = ZigZagBarsM1; int WF,SW,ND,i,ZZU,ZZD,PP,T1,T2,T3,T4,T5; double LL,HH,BeHigh,BeLow; double UNIT;
double vbid = MarketInfo(Symbol(), MODE_BID); double vask = MarketInfo(Symbol(), MODE_ASK); double vpoint= MarketInfo(Symbol(), MODE_POINT); int vdigits = (int)MarketInfo(Symbol(),MODE_DIGITS); int vspread = (int)MarketInfo(Symbol(),MODE_SPREAD); int koeff;
if(vdigits==0) koeff = 1; if(vdigits==1) koeff = 10; if(vdigits==2) koeff = 100; if(vdigits==3) koeff = 1000; if(vdigits==4) koeff = 10000; if(vdigits==5) koeff = 100000; if(vdigits==6) koeff = 1000000;
SW =0; WF =0; ND =0; BeHigh =High; BeLow =Low ; ZZU = nBArrowSize; ZZD = nBArrowSize;
//Time to bar expiry int m,s;
m=Time+Period()*60-CurTime(); s=m%60; m=(m-s)/60;
string _sp="",_m="",_s=""; if(vspread<10) _sp=".."; else if(vspread<100) _sp="."; if(m<10) _m="0"; if(s<10) _s="0";
for(shift=nBArrowSize; shift>=0; shift--) { LL =100000; HH = -100000; for(i=shift+ZigZagBars; i>=shift+1; i--) { if(Low< LL) { LL=Low; }; if(High>HH) { HH=High; }; }; if(Low<LL && High>HH) { WF=2; if(SW==1) { ZZU=shift+1; }; if(SW==-1) { ZZD=shift+1; }; } else { if(Low<LL) { WF=-1; }; if(High>HH) { WF=1; }; }; if(WF!=SW && SW!=0) { if(WF==2) { WF=-SW; BeHigh = High; BeLow = Low; }; ND=ND+1; if(WF==1) { UNIT=ZZD; UNIT=BeLow; }; if(WF==-1) { UNIT=ZZU; UNIT=BeHigh; }; BeHigh = High; BeLow = Low; }; if(WF==1) { if(High>=BeHigh) { BeHigh=High; ZZU=shift; }; }; if(WF==-1) { if(Low<=BeLow) { BeLow=Low; ZZD=shift; }; }; SW=WF; };
for(i=1; i<=ND; i++) { PP =StrToInteger(DoubleToStr(UNIT ,0)); T1 =StrToInteger(DoubleToStr(UNIT ,0)); T2 =StrToInteger(DoubleToStr(UNIT,0)); T3 =StrToInteger(DoubleToStr(UNIT,0)); T4 =StrToInteger(DoubleToStr(UNIT,0)); T5 =StrToInteger(DoubleToStr(UNIT,0));
EMB =UNIT;
double s1 =UNIT; double s2 =UNIT; double s3 =UNIT; double s4 =UNIT; double s5 =UNIT; double dif100 =MathAbs(s1-s2)*100; double difPoints =MathAbs(s1-s2); double proc14 =dif100*0.146; double proc76 =dif100*0.764; double dif14 =difPoints*0.146; double dif76 =difPoints*0.764; double STLoss; double TMedPrice =0.0; int TBarPrice =0; };
if(TreandLines1) { ObjectCreate(0,"TreandLines1",OBJ_TREND,0,Time,s3,Time,s1); ObjectSetInteger(0,"TreandLines1",OBJPROP_COLOR,TreandLines1clr); ObjectSetInteger(0,"TreandLines1",OBJPROP_STYLE,TreandLinesStyle1); ObjectSetInteger(0,"TreandLines1",OBJPROP_WIDTH,TreandLines1WIDTH); ObjectSetInteger(0,"TreandLines1",OBJPROP_BACK,true); ObjectSetInteger(0,"TreandLines1",OBJPROP_RAY_RIGHT,true); };
if(TreandLines2) { ObjectCreate(0,"TreandLines2",OBJ_TREND,0,Time,s4,Time,s2); ObjectSetInteger(0,"TreandLines2",OBJPROP_COLOR,TreandLines2clr); ObjectSetInteger(0,"TreandLines2",OBJPROP_STYLE,TreandLinesStyle2); ObjectSetInteger(0,"TreandLines2",OBJPROP_WIDTH,TreandLines2WIDTH); ObjectSetInteger(0,"TreandLines2",OBJPROP_BACK,true); ObjectSetInteger(0,"TreandLines2",OBJPROP_RAY_RIGHT,true); };
for(shift=0; shift<nBArrowSize; shift++) { if(s1<s2) {
if(ShowArrow) SetArrow(225, LineColorBuy, "Buy",Time, BeLow, ArrowSize); if(ShowHLine) SetHLine(LineColorBuy, "Buy Line",BeLow, 0, LineWidth); if(ShowHLine) SetHLine(LineColorStopLoss, "StopLoss Buy", s1, 0, LineWidth);
ObjectDelete("Sell Line"); ObjectDelete("Sell"); ObjectDelete("StopLoss Sell");
STLoss =MathAbs(s1-BeLow)*koeff; TMedPrice =NormalizeDouble(s3+(MathAbs(s2-s3)*0.5),Digits); TBarPrice = ((T3-T2)*0.5)+T2;
//Comment ( " TMedPrice =", TMedPrice," \n", // " T2 =", T2, " \n", // " T3 =", T3, " \n", // " TBarPrice =", TBarPrice , " \n" //);
if(Pitchwork1) { ObjectCreate(0,"PitchWorksBuy",OBJ_PITCHFORK,0,Time,TMedPrice,Time,s1,Time,s2); ObjectSetInteger(0,"PitchWorksBuy",OBJPROP_COLOR,clrPitchWorkBuy); ObjectSetInteger(0,"PitchWorksBuy",OBJPROP_WIDTH,PitchWorksWIDTH); ObjectSetInteger(0,"PitchWorksBuy",OBJPROP_STYLE,PitchWorkstyle); };
免费获取指标方法如下↓↓↓第一步:先点亮文章右下角的“”再点“”;第二步:点击下方名片关注公众号“量化程序”;
第三步:进入公众号回复关键词:“ZFV5 ”,获取指标公式;(请务必准确回复关键词,否则可能无效) 基本没多大用处,都是基于ziazig,有重绘的功能,谢谢诶分享 路过看看,支持一下。 觉得不实用 看起来会重绘 看着还行 有使用的吗 没见过,谢谢分享
页:
[1]