首页 > 编程语言 >斐波那契时间序列,精准捕捉市场拐点 MT4免费公式源码!

斐波那契时间序列,精准捕捉市场拐点 MT4免费公式源码!

时间:2024-10-31 16:46:07浏览次数:4  
标签:bar color shift Symbol MT4 斐波 qc 源码 time

指标名称:斐波那契时间序列

版本:MT4 ver. 2.01

斐波那契时间序列是一种技术分析工具,通过将斐波那契数列(如1, 2, 3, 5, 8, 13等)应用于时间轴上,用于预测市场价格的时间周期拐点。斐波那契时间序列在股票、外汇和其他市场分析中常用,帮助预测趋势反转或调整发生的时间节点。

斐波那契数列是一个递增的数字序列,每一个数是前两个数之和。这个数列在自然界和金融市场中经常出现,因此被用于技术分析。斐波那契时间序列假设市场价格波动的时间点会与斐波那契数值(或比例)相吻合,即市场的调整或反转可能发生在斐波那契数列中的某个时间间隔上。


应用步骤

  • 选择起始点:在趋势(上涨或下跌)中选择一个明显的起点,通常是价格触底或峰值的地方。

  • 应用斐波那契数列:将1, 2, 3, 5, 8, 13, 21等斐波那契数应用在时间周期上,以预测趋势可能的拐点。例如,从起始点开始,向后数2天、3天、5天等,找到这些天数作为潜在的趋势变化点。

  • 观察市场变化:在这些时间点附近,观察价格走势是否有反转、调整或加速变化。如果市场在这些时间点附近确实发生变化,可以结合其他指标进一步确认。

  • 结合其他技术指标:斐波那契时间序列通常和其他技术指标(如斐波那契回调线、RSI、MACD等)结合使用,以提高预测的准确性。

参数:

完整代码展示: ​​

//+------------------------------------------------------------------+//画斐波那契时间序列#property version   "2.01"
#property description "---------------------------------------------"#property description "EA、指标公式分享"#property description "EA、指标编写业务承接"#property description "---------------------------------------------"#property description "---------------------------------------------"
#property indicator_chart_window
extern color color_RAY = Gold;extern int   STYLE = 4;//0-4extern int   WIDTH = 1;//0-6extern string time_start = "2024.10.28 10:12";extern string time_finish = "2024.10.28 10:25";extern int DELTA_K = 4;
//+------------------------------------------------------------------+//| Custom indicator initialization function                         |//+------------------------------------------------------------------+int init(){   GetDellName();//---- indicators//----   return(0);  }//+------------------------------------------------------------------+//| Custom indicator deinitialization function                       |//+------------------------------------------------------------------+int deinit(){//----   GetDellName();   ObjectsDeleteAll();//----   return(0);  }//+------------------------------------------------------------------+//| Custom indicator iteration function                              |//+------------------------------------------------------------------+int start(){//----   GetStartLine(time_start,time_finish,"fibo1","luch1",color_RAY,STYLE,WIDTH);   GetYTG();   GetAvtor();//----   return(0);  }//+------------------------------------------------------------------+
void GetTXT(string name_label,datetime t1, double p1,color c = Red, string txt = "zero",double angle = 90){   datetime dlt = DELTA_K * 60;   if(ObjectFind(name_label)<0)       ObjectCreate(name_label,OBJ_TEXT,0,t1-dlt,p1,0,0);   ObjectSet(name_label,OBJPROP_ANGLE,angle);   ObjectSetText(name_label, txt, 10, "Times New Roman", c);  }
void GetVLINE(string name_label,datetime t1,color c = Red,int style = 0, int widh = 0){   if(ObjectFind(name_label)<0) // ObjectDelete(name_label);      ObjectCreate(name_label,OBJ_VLINE,0,t1,0,0,0);   ObjectSet(name_label,OBJPROP_COLOR,c);   ObjectSet(name_label,OBJPROP_STYLE,style);   ObjectSet(name_label,OBJPROP_WIDTH,widh);  }
void GetDellName(string name_n = ""){   string vName;   for(int i=ObjectsTotal()-1; i>=0; i--)     {      vName = ObjectName(i);      if(StringFind(vName,name_n) !=-1)         ObjectDelete(vName);     }  }//----+ôóíêöèÿ ñòðîèò âñå ëèíèè fibo timevoid GetStartLine(string ti_s, string ti_f, string n, string l, color c, int s, int w) //,s,w{   GetDellName(l);
   GetVLINE(n+"qc_zoltan1",StrToTime(ti_s),c,s,w);   GetVLINE(n+"qc_zoltan2",StrToTime(ti_f),c,s,w);   datetime time_s =0, time_f =0, time_c = 0;   if(ObjectFind(n+"qc_zoltan1")!=-1)      time_s = ObjectGet(n+"qc_zoltan1",OBJPROP_TIME1);   if(ObjectFind(n+"qc_zoltan2")!=-1)      time_f = ObjectGet(n+"qc_zoltan2",OBJPROP_TIME1);
   int bars_1 = iBarShift(Symbol(),1,time_s);   int bars_2 = iBarShift(Symbol(),1,time_f);   Comment(bars_1,"  ",bars_2);   int delta_bars = bars_1-bars_2;   double prise_b = iClose(Symbol(),1,bars_1);
   GetTXT(l+"qc_zoltan11",time_s, prise_b,c,"0");   GetTXT(l+"qc_zoltan22",time_f, prise_b,c,"1");
   int bar_shift = bars_2 - delta_bars;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan3",time_c,c,s,w);//2   GetTXT(l+"qc_zoltan33",time_c, prise_b,c,"2");
   bar_shift = bar_shift - delta_bars;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan4",time_c,c,s,w);//3   GetTXT(l+"qc_zoltan44",time_c, prise_b,c,"3");
   bar_shift = bar_shift - delta_bars*2;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan5",time_c,c,s,w);//4   GetTXT(l+"qc_zoltan55",time_c, prise_b,c,"5");
   bar_shift = bar_shift - delta_bars*3;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan6",time_c,c,s,w);//8   GetTXT(l+"qc_zoltan66",time_c, prise_b,c,"8");
   bar_shift = bar_shift - delta_bars*5;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan7",time_c,c,s,w);//13   GetTXT(l+"qc_zoltan77",time_c, prise_b,c,"13");
   bar_shift = bar_shift - delta_bars*8;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan8",time_c,c,s,w);//21   GetTXT(l+"qc_zoltan88",time_c, prise_b,c,"21");
   bar_shift = bar_shift - delta_bars*13;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan9",time_c,c,s,w);//34   GetTXT(l+"qc_zoltan99",time_c, prise_b,c,"34");
   bar_shift = bar_shift - delta_bars*21;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan10",time_c,c,s,w);//55   GetTXT(l+"qc_zoltan331",time_c, prise_b,c,"55");
   bar_shift = bar_shift - delta_bars*34;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan011",time_c,c,s,w);//89   GetTXT(l+"qc_zoltan332",time_c, prise_b,c,"89");
   bar_shift = bar_shift - delta_bars*55;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan12",time_c,c,s,w);//144   GetTXT(l+"qc_zoltan3322",time_c, prise_b,c,"144");
   bar_shift = bar_shift - delta_bars*89;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan13",time_c,c,s,w);//233   GetTXT(l+"qc_zoltan333",time_c, prise_b,c,"233");
   bar_shift = bar_shift - delta_bars*144;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan14",time_c,c,s,w);//377   GetTXT(l+"qc_zoltan334",time_c, prise_b,c,"377");
   bar_shift = bar_shift - delta_bars*233;   if(bar_shift<0)      time_c = iTime(Symbol(),1,0)+MathAbs(bar_shift)*60;   else      time_c = iTime(Symbol(),1,bar_shift);   GetVLINE(l+"qc_zoltan15",time_c,c,s,w);//610   GetTXT(l+"qc_zoltan335",time_c, prise_b,c,"610");
  }//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+void Label(string name_label,           string text_label,           int corner = 2,           int x = 3,           int y = 15,           int font_size = 10,           string font_name = "Arial",           color text_color = LimeGreen          ){   if(ObjectFind(name_label)!=-1)      ObjectDelete(name_label);   ObjectCreate(name_label,OBJ_LABEL,0,0,0,0,0);   ObjectSet(name_label,OBJPROP_CORNER,corner);   ObjectSet(name_label,OBJPROP_XDISTANCE,x);   ObjectSet(name_label,OBJPROP_YDISTANCE,y);   ObjectSetText(name_label,text_label,font_size,font_name,text_color);  }//----+void GetYTG(){   static int count = 0;   count++;   if(count>2)      count = 0;   color color_Y = Red;   color color_T = Lime;   color color_G = Blue;   if(count==1)     {      color_Y = Crimson;      color_T = LimeGreen;      color_G = DodgerBlue;     }   if(count==2)     {      color_Y = OrangeRed;      color_T = ForestGreen;      color_G = RoyalBlue;     }
   Label("qchaos_Q","Q",3,40,20,25,"Arial Black",color_Y);   Label("qchaos_C","C",3,25,5,25,"Arial Black",color_T);   Label("qchaos_S","Q",3,40,20,25,"Arial Black",color_G);//Label("qchaos_Q1","Q" ,3,13,32,25,"Arial Black",color_G);
  }
//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+void GetAvtor(){   static int tick = 0;   tick++;   if(tick >= 42)      tick = 0;   string tchar[256];   int i;   string f_n = "Arial";   for(i = 0; i < 256; i++)      tchar[i] = CharToStr(i);   int x=0;   int y=0;   int z=0;   Label("label1", tchar[87], 2+x, 5, 15, 10, f_n, GetColor(41, tick));     Label("label2", tchar[101], 2+x, 18, 15, 10, f_n, GetColor(0, tick));    Label("label3", tchar[67], 2+x, 24, 15, 10, f_n, GetColor(1, tick));     Label("label4", tchar[104], 2+x, 32, 15, 10, f_n, GetColor(2, tick));    Label("label5", tchar[97], 2+x, 40, 15, 10, f_n, GetColor(3, tick));      Label("label6", tchar[116], 2+x, 48, 15, 10, f_n, GetColor(4, tick));     Label("label7", tchar[32], 2+x, 56, 15, 10, f_n, GetColor(5, tick));    Label("label8", tchar[58], 2+x, 54, 15, 10, f_n, GetColor(6, tick));   Label("label9", tchar[81], 2+x, 61, 15, 10, f_n, GetColor(7, tick));       Label("label10", tchar[67], 2+x, 70, 15, 10, f_n, GetColor(8, tick));      Label("label11", tchar[104], 2+x, 78, 15, 10, f_n, GetColor(9, tick));     Label("label12", tchar[97], 2+x, 86, 15, 10, f_n, GetColor(10, tick));      Label("label13", tchar[111], 2+x, 94, 15, 10, f_n, GetColor(11, tick));     Label("label14", tchar[115], 2+x, 102, 15, 10, f_n, GetColor(12, tick));     Label("label15", tchar[48], 2+x, 110, 15, 10, f_n, GetColor(13, tick));     Label("label16", tchar[48], 2+x, 118, 15, 10, f_n, GetColor(14, tick));    Label("label17", tchar[49], 2+x, 126, 15, 10, f_n, GetColor(15, tick));    }//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+color GetColor(int n, int t){   color colir = LimeGreen;   if(n==t || n+1==t || n+2==t)      colir = Yellow;   if(n+10==t || n+11==t || n+12==t)      colir = Aqua;   if(n+20==t || n+21==t || n+22==t)      colir = Gold;   return(colir);  }//+------------------------------------------------------------------+

标签:bar,color,shift,Symbol,MT4,斐波,qc,源码,time
From: https://blog.csdn.net/pioneer_plus/article/details/143405566

相关文章