Category: METATRADER4Z
Zone.mq4
Zone.mq4 FOREX MetaTrader4 Indicators Download
Zone.mq4 download link will appear after 10 seconds.
Zone.mq4 Programming source code.
#property indicator_chart_window extern string _ = "œÂËÓ‰ ÓÔ. ÁÓÌ (1-M1, 5-M5, 15-M15, 30-M30, 60-Õ1, 240-Õ4, 1440-D1, 10080-W1, 43200-MN1)"; extern int TF = 60; extern string __ = " ÓÎ-‚Ó ·‡Ó‚ ‚ ‰Îˇ ÓÔ‰ÂÎÂÌˡ ÁÓÌ"; extern int MaxBars = 1000; extern color Rcolor = Red; extern color Scolor = LimeGreen; extern color TxtColor = DarkGray; extern bool BackGround = FALSE; extern int RectangleWidth = 2; extern int RectangleStyle = 0; extern int TxtSize = 8; extern string ___ = "—‰‚Ë„ ÁÓÌ˚ Ô‡‚Ó Ì‡ RectShift ·‡Ó‚"; extern int RectShift = 10; extern string ____ = "œ‡‡ÏÂÚ˚ ÓÔ‰ÂÎÂÌˡ ¿Œ"; extern int MA1 = 1; extern int MA2 = 5; extern int Metod_MA = 1; extern int Price_MA = 0; int Gi_164 = 4; int Gi_168; int Gi_172; int G_bars_176; int G_bars_180; string Gs_184; bool Gi_192; int Gia_196[]; int Gia_200[]; double Gda_204[]; double Gda_208[]; string Gsa_212[]; // E37F0136AA3FFAF149B351F6A4C948E9 int init() { switch (TF) { case 1: Gs_184 = "M1"; break; case 5: Gs_184 = "M5"; break; case 15: Gs_184 = "M15"; break; case 30: Gs_184 = "M30"; break; case 60: Gs_184 = "H1"; break; case 240: Gs_184 = "H4"; break; case 1440: Gs_184 = "D1"; break; case 10080: Gs_184 = "W1"; break; case 43200: Gs_184 = "MN1"; break; default: Alert(" œÂËÓ‰ Ì Ô‰ÛÒÏÓÚÂÌ ÔÓ„‡ÏÏÓÈ! ”ÒÚ‡ÌÓ‚ÎÂÌ ÔÂËÓ‰ Õ1"); TF = 60; Gs_184 = "H1"; } Gi_192 = TRUE; return (0); } // 52D46093050F38C27267BCE42543EF60 void deinit() { for (int count_0 = 0; count_0 < MaxBars / 3; count_0++) { ObjectDelete("R" + Gs_184 + count_0); ObjectDelete("R" + Gs_184 + "t" + count_0); ObjectDelete("R" + Gs_184 + "l" + count_0); ObjectDelete("S" + Gs_184 + count_0); ObjectDelete("S" + Gs_184 + "t" + count_0); ObjectDelete("S" + Gs_184 + "l" + count_0); } } // 945D754CB0DC06D04243FCBA25FC0802 int f0_3(int Ai_0) { double Ld_4 = iMA(NULL, TF, MA1, 0, Metod_MA, Price_MA, Ai_0) - iMA(NULL, TF, MA2, 0, Metod_MA, Price_MA, Ai_0); if (Ld_4 > Point / 2.0) return (1); if (Ld_4 < (-Point) / 2.0) return (-1); return (0); } // 2569208C5E61CB15E209FFE323DB48B7 int f0_1(int Ai_0) { if (Ai_0 < iBars(Symbol(), TF) - 3) { if (iHigh(NULL, TF, Ai_0 + 2) < iHigh(NULL, TF, Ai_0 + 1) && iHigh(NULL, TF, Ai_0 + 1) < iHigh(NULL, TF, Ai_0)) return (1); return (0); } return (0); } // 6ABA3523C7A75AAEA41CC0DEC7953CC5 int f0_2(int Ai_0) { if (Ai_0 < iBars(Symbol(), TF) - 2) { if (!(!iLow(NULL, TF, Ai_0 + 2) > iLow(NULL, TF, Ai_0 + 1) && iLow(NULL, TF, Ai_0 + 1) > iLow(NULL, TF, Ai_0))) return (1); return (0); } return (0); } // 09CBB5F5CE12C31A043D5C81BF20AA4A int f0_0(int Ai_0) { if (iLow(NULL, TF, Ai_0) == iLow(NULL, TF, Ai_0 - 1)) Ai_0--; if (Ai_0 > 3) { if (!(!(iHigh(NULL, TF, Ai_0) < iHigh(NULL, TF, Ai_0 - 1) && iHigh(NULL, TF, Ai_0 - 1) < iHigh(NULL, TF, Ai_0 - 2)) || (iHigh(NULL, TF, Ai_0 - 1) < iHigh(NULL, TF, Ai_0 - 2) && iHigh(NULL, TF, Ai_0 - 2) < iHigh(NULL, TF, Ai_0 - 3)))) return (1); return (0); } return (0); } // 9B1AEE847CFB597942D106A4135D4FE6 int f0_4(int Ai_0) { if (iHigh(NULL, TF, Ai_0) == iHigh(NULL, TF, Ai_0 - 1)) Ai_0--; if (Ai_0 > 3) { if (!(!(iLow(NULL, TF, Ai_0) > iLow(NULL, TF, Ai_0 - 1) && iLow(NULL, TF, Ai_0 - 1) > iLow(NULL, TF, Ai_0 - 2)) || (iLow(NULL, TF, Ai_0 - 1) > iLow(NULL, TF, Ai_0 - 2) && iLow(NULL, TF, Ai_0 - 2) > iLow(NULL, TF, Ai_0 - 3)))) return (1); return (0); } return (0); } // EA2B2676C28C0DB26D39331A336C6B92 int start() { int index_0; bool Li_4; int highest_8; int highest_12; int Li_16; int Li_20; int highest_24; int highest_28; double Ld_32; double Ld_40; double ihigh_48; double ilow_56; double Ld_64; bool bool_72; bool bool_76; bool Li_80; bool Li_84; G_bars_176 = Bars; Gi_168 = iBars(Symbol(), TF); if (Gi_172 != Gi_168 || Gi_192) { Gi_192 = FALSE; Gi_172 = Gi_168; ArrayResize(Gia_196, 0); ArrayResize(Gia_200, 0); ArrayResize(Gda_204, 0); ArrayResize(Gda_208, 0); ArrayResize(Gsa_212, 0); index_0 = 0; if (MaxBars > Gi_168) MaxBars = Gi_168; for (int Li_88 = f0_3(MaxBars); Li_88 == 0; Li_88 = f0_3(MaxBars)) MaxBars--; Li_16 = MaxBars; for (int Li_92 = MaxBars; Li_92 > 2; Li_92--) { Li_80 = FALSE; Li_84 = FALSE; Li_20 = f0_3(Li_92); bool_72 = f0_1(Li_92) && f0_4(Li_92); bool_76 = f0_2(Li_92) && f0_0(Li_92); if (bool_72) { highest_24 = iHighest(NULL, TF, MODE_OPEN, 6, Li_92 - 3); Ld_32 = iOpen(NULL, TF, highest_24); highest_28 = iHighest(NULL, TF, MODE_CLOSE, 6, Li_92 - 3); Ld_40 = iClose(NULL, TF, highest_28); if (Ld_40 > Ld_32) highest_8 = highest_28; else highest_8 = highest_24; highest_8 = iHighest(NULL, TF, MODE_HIGH, 3, highest_8 - 1); ihigh_48 = iHigh(NULL, TF, highest_8); Li_80 = TRUE; } else { if (Li_20 != Li_88 && Li_20 != 0 && Li_88 > 0) { if (Li_16 - Li_92 > 1) { highest_24 = iHighest(NULL, TF, MODE_OPEN, Li_16 - Li_92, Li_92); Ld_32 = iOpen(NULL, TF, highest_24); highest_28 = iHighest(NULL, TF, MODE_CLOSE, Li_16 - Li_92, Li_92); Ld_40 = iClose(NULL, TF, highest_28); if (Ld_40 > Ld_32) highest_8 = highest_28; else highest_8 = highest_24; highest_8 = iHighest(NULL, TF, MODE_HIGH, 3, highest_8 - 1); ihigh_48 = iHigh(NULL, TF, highest_8); if (f0_1(highest_8) || f0_4(highest_8) || Li_16 - Li_92 > Gi_164) Li_80 = TRUE; } Li_88 = Li_20; Li_16 = Li_92; } } if (bool_76) { highest_24 = iLowest(NULL, TF, MODE_OPEN, 6, Li_92 - 3); Ld_32 = iOpen(NULL, TF, highest_24); highest_28 = iLowest(NULL, TF, MODE_CLOSE, 6, Li_92 - 3); Ld_40 = iClose(NULL, TF, highest_28); if (Ld_40 < Ld_32) highest_12 = highest_28; else highest_12 = highest_24; ilow_56 = iLow(NULL, TF, highest_12); Li_84 = TRUE; } else { if (Li_20 != Li_88 && Li_20 != 0 && Li_88 < 0) { if (Li_16 - Li_92 > 1) { highest_24 = iLowest(NULL, TF, MODE_OPEN, Li_16 - Li_92, Li_92); Ld_32 = iOpen(NULL, TF, highest_24); highest_28 = iLowest(NULL, TF, MODE_CLOSE, Li_16 - Li_92, Li_92); Ld_40 = iClose(NULL, TF, highest_28); if (Ld_40 < Ld_32) highest_12 = highest_28; else highest_12 = highest_24; highest_12 = iLowest(NULL, TF, MODE_LOW, 3, highest_12 - 1); ilow_56 = iLow(NULL, TF, highest_12); if (f0_2(highest_12) || f0_0(highest_12) || Li_16 - Li_92 > Gi_164) Li_84 = TRUE; } Li_88 = Li_20; Li_16 = Li_92; } } if (Li_80) { Ld_32 = iOpen(NULL, TF, iHighest(NULL, TF, MODE_OPEN, highest_8 + 1)); Ld_40 = iClose(NULL, TF, iHighest(NULL, TF, MODE_CLOSE, highest_8 + 1)); if (Ld_40 > Ld_32) Ld_64 = Ld_40; else Ld_64 = Ld_32; Li_4 = FALSE; if (Ld_64 <= ihigh_48) { for (int Li_96 = index_0; Li_96 >= 0; Li_96--) { if (Gsa_212[Li_96] == "R" && Gia_200[Li_96] > iTime(NULL, TF, Li_92)) { if (ihigh_48 <= Gda_204[Li_96] && Ld_64 >= Gda_208[Li_96]) { Li_4 = TRUE; continue; } if (ihigh_48 > Gda_204[Li_96]) { Gia_200[Li_96] = iTime(NULL, TF, highest_8); continue; } if (Ld_64 <= Gda_208[Li_96] && ihigh_48 >= Gda_208[Li_96] && ihigh_48 <= Gda_204[Li_96]) { Gia_200[Li_96] = iTime(NULL, TF, highest_8); ihigh_48 = Gda_204[Li_96]; } } } } if (Ld_64 <= ihigh_48 && Li_4 == FALSE) { ArrayResize(Gia_196, index_0 + 1); ArrayResize(Gia_200, index_0 + 1); ArrayResize(Gda_204, index_0 + 1); ArrayResize(Gda_208, index_0 + 1); ArrayResize(Gsa_212, index_0 + 1); Gia_196[index_0] = iTime(NULL, TF, highest_8); Gia_200[index_0] = iTime(NULL, 0, 0) + 60 * RectShift * Period(); Gda_204[index_0] = ihigh_48; Gda_208[index_0] = Ld_64; Gsa_212[index_0] = "R"; index_0++; } Li_80 = FALSE; } if (Li_84) { Ld_32 = iOpen(NULL, TF, iLowest(NULL, TF, MODE_OPEN, highest_12 + 1)); Ld_40 = iClose(NULL, TF, iLowest(NULL, TF, MODE_CLOSE, highest_12 + 1)); if (Ld_40 < Ld_32) Ld_64 = Ld_40; else Ld_64 = Ld_32; Li_4 = FALSE; if (Ld_64 >= ilow_56) { for (Li_96 = index_0; Li_96 >= 0; Li_96--) { if (Gsa_212[Li_96] == "S" && Gia_200[Li_96] > iTime(NULL, TF, Li_92)) { if (ilow_56 >= Gda_204[Li_96] && Ld_64 <= Gda_208[Li_96]) { Li_4 = TRUE; continue; } if (ilow_56 < Gda_204[Li_96]) { Gia_200[Li_96] = iTime(NULL, TF, highest_12); continue; } if (Ld_64 >= Gda_208[Li_96] && ilow_56 <= Gda_208[Li_96] && ilow_56 >= Gda_204[Li_96]) { Gia_200[Li_96] = iTime(NULL, TF, highest_12); ilow_56 = Gda_204[Li_96]; } } } } if (Ld_64 >= ilow_56 && Li_4 == FALSE) { ArrayResize(Gia_196, index_0 + 1); ArrayResize(Gia_200, index_0 + 1); ArrayResize(Gda_204, index_0 + 1); ArrayResize(Gda_208, index_0 + 1); ArrayResize(Gsa_212, index_0 + 1); Gia_196[index_0] = iTime(NULL, TF, highest_12); Gia_200[index_0] = iTime(NULL, 0, 0) + 60 * RectShift * Period(); Gda_204[index_0] = ilow_56; Gda_208[index_0] = Ld_64; Gsa_212[index_0] = "S"; index_0++; } Li_84 = FALSE; } } } if (G_bars_180 != G_bars_176) { G_bars_180 = G_bars_176; for (Li_92 = 0; Li_92 < MaxBars / 3; Li_92++) { ObjectDelete("R" + Gs_184 + Li_92); ObjectDelete("R" + Gs_184 + "t" + Li_92); ObjectDelete("R" + Gs_184 + "l" + Li_92); ObjectDelete("S" + Gs_184 + Li_92); ObjectDelete("S" + Gs_184 + "t" + Li_92); ObjectDelete("S" + Gs_184 + "l" + Li_92); } for (Li_92 = 0; Li_92 < ArraySize(Gia_196); Li_92++) { if (iBarShift(NULL, TF, Gia_200[Li_92]) <= 0) Gia_200[Li_92] = iTime(NULL, 0, 0) + 60 * RectShift * Period(); if (Gsa_212[Li_92] == "R") { ObjectCreate("R" + Gs_184 + Li_92, OBJ_RECTANGLE, 0, Gia_196[Li_92], Gda_204[Li_92], Gia_200[Li_92], Gda_208[Li_92]); ObjectSet("R" + Gs_184 + Li_92, OBJPROP_COLOR, Rcolor); ObjectSet("R" + Gs_184 + Li_92, OBJPROP_BACK, BackGround); ObjectSet("R" + Gs_184 + Li_92, OBJPROP_WIDTH, RectangleWidth); ObjectSet("R" + Gs_184 + Li_92, OBJPROP_STYLE, RectangleStyle); if (Gda_204[Li_92] == Gda_208[Li_92]) ObjectSet("R" + Gs_184 + Li_92, OBJPROP_BACK, FALSE); if (iBarShift(NULL, TF, Gia_200[Li_92]) <= 0) { ObjectCreate("R" + Gs_184 + "l" + Li_92, OBJ_TREND, 0, Gia_196[Li_92], Gda_208[Li_92], Gia_200[Li_92], Gda_208[Li_92]); ObjectSet("R" + Gs_184 + "l" + Li_92, OBJPROP_COLOR, TxtColor); ObjectSet("R" + Gs_184 + "l" + Li_92, OBJPROP_STYLE, STYLE_DOT); ObjectCreate("R" + Gs_184 + "t" + Li_92, OBJ_TEXT, 0, Gia_200[Li_92], Gda_208[Li_92] + TxtSize / 4 * Point); ObjectSetText("R" + Gs_184 + "t" + Li_92, "R" + Gs_184, TxtSize, "Arial", TxtColor); } } else { if (Gsa_212[Li_92] == "S") { ObjectCreate("S" + Gs_184 + Li_92, OBJ_RECTANGLE, 0, Gia_196[Li_92], Gda_204[Li_92], Gia_200[Li_92], Gda_208[Li_92]); ObjectSet("S" + Gs_184 + Li_92, OBJPROP_COLOR, Scolor); ObjectSet("S" + Gs_184 + Li_92, OBJPROP_BACK, BackGround); ObjectSet("S" + Gs_184 + Li_92, OBJPROP_WIDTH, RectangleWidth); ObjectSet("S" + Gs_184 + Li_92, OBJPROP_STYLE, RectangleStyle); if (Gda_204[Li_92] == Gda_208[Li_92]) ObjectSet("S" + Gs_184 + Li_92, OBJPROP_BACK, FALSE); if (iBarShift(NULL, TF, Gia_200[Li_92]) <= 0) { ObjectCreate("S" + Gs_184 + "l" + Li_92, OBJ_TREND, 0, Gia_196[Li_92], Gda_208[Li_92], Gia_200[Li_92], Gda_208[Li_92]); ObjectSet("S" + Gs_184 + "l" + Li_92, OBJPROP_COLOR, TxtColor); ObjectSet("S" + Gs_184 + "l" + Li_92, OBJPROP_STYLE, STYLE_DOT); ObjectCreate("S" + Gs_184 + "t" + Li_92, OBJ_TEXT, 0, Gia_200[Li_92], Gda_208[Li_92]); ObjectSetText("S" + Gs_184 + "t" + Li_92, "S" + Gs_184, TxtSize, "Arial", TxtColor); } } } } } return (0); }
ZigzagFr_v1.mq4
ZigzagFr_v1.mq4 FOREX MetaTrader4 Indicators Download
ZigzagFr_v1.mq4 download link will appear after 10 seconds.
ZigzagFr_v1.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 1 #property indicator_width1 3 #property indicator_color1 Blue extern int Fractal = 10; //ÒÍÓθÍÓ Ù‡ÍÚ‡ÎÓ‚ Ò Í‡Ê‰ÓÈ ÒÚÓÓÌ˚ ËÒÔÓθÁÛÂÚÒˇ ‰Îˇ ÓÔ‰ÂÎÂÌˡ ÌÛÊÌÓ„Ó Ù‡Íڇ· double up,dn; double Buffer[]; datetime TimednBar,TimeupBar; //+------------------------------------------------------------------+ int init() { Comment("ZigzagFr_v1","\n","Copyright © 2010, Vladimir Hlystov","\n","http://cmillion.narod.ru"); IndicatorBuffers(1); SetIndexStyle(0,DRAW_SECTION); SetIndexBuffer(0,Buffer); return(0); } //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit=Bars-counted_bars; int dnBar = iBarShift(NULL,0,TimednBar,true); int upBar = iBarShift(NULL,0,TimeupBar,true); if (limit0; i--) { fr = Fractal(MODE_LOWER,i); if (fr!=0 && (fr up) { if (up!=0) { upBar = iBarShift(NULL,0,TimeupBar,true); Buffer[upBar]=EMPTY_VALUE; /* Name="upBar"+Time[0]; ObjectDelete(Name); ObjectCreate(Name, OBJ_ARROW,0,Time[upBar],High[upBar],0,0,0,0); ObjectSet (Name, OBJPROP_WIDTH, 3); ObjectSet (Name, OBJPROP_ARROWCODE,217); ObjectSet (Name, OBJPROP_COLOR, Blue);*/ } Buffer[i]=fr; up=fr; dn=0; TimeupBar=Time[i]; } else Buffer[i]=EMPTY_VALUE; } } return(0); } //+------------------------------------------------------------------+ double Fractal(int tip,int bar) { int i,n; double fr,fr1; if (tip==MODE_UPPER) { fr1 = iFractals(NULL,0,MODE_UPPER,bar); if (fr1==0) return(0); i=bar;n=0; while (true) { i++; if (i>Bars) return(0); fr = iFractals(NULL,0,MODE_UPPER,i); if (fr==0) continue; else n++; if (n>=Fractal) break; if (fr>fr1) return(0); } i=bar;n=0; while (true) { i--; if (i==0) return(0); fr = iFractals(NULL,0,MODE_UPPER,i); if (fr==0) continue; else n++; if (n>=Fractal) break; if (fr>fr1) return(0); } return(fr1); } if (tip==MODE_LOWER) { fr1 = iFractals(NULL,0,MODE_LOWER,bar); if (fr1==0) return(0); i=bar;n=0; while (true) { i++; if (i>Bars) return(0); fr = iFractals(NULL,0,MODE_LOWER,i); if (fr==0) continue; else n++; if (n>=Fractal) break; if (fr =Fractal) break; if (fr
ZigZag_ws_Chanel_SweetSNR.mq4
ZigZag_ws_Chanel_SweetSNR.mq4 FOREX MetaTrader4 Indicators Download
ZigZag_ws_Chanel_SweetSNR.mq4 download link will appear after 10 seconds.
ZigZag_ws_Chanel_SweetSNR.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_width1 2 #property indicator_color2 Pink #property indicator_color3 Pink //---- indicator parameters extern int ExtDepth=100; extern int ExtDeviation=10; extern int ExtBackstep=5; //---- indicator buffers double ZigzagBuffer[]; double HighMapBuffer[]; double LowMapBuffer[]; double BufChanelHigh[]; double BufChanelLow[]; double BufLastHigh[]; double BufLastLow[]; int level=3; // recounting's depth bool downloadhistory=false; string LabelName; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(7); //---- drawing settings SetIndexStyle(0,DRAW_SECTION); SetIndexBuffer(0,ZigzagBuffer); SetIndexEmptyValue(0,0.0); SetIndexStyle(1, DRAW_SECTION); SetIndexBuffer(1,BufChanelHigh); SetIndexEmptyValue(1,0.0); SetIndexStyle(2, DRAW_SECTION); SetIndexBuffer(2,BufChanelLow); SetIndexEmptyValue(2,0.0); SetIndexBuffer(3,HighMapBuffer); SetIndexBuffer(4,LowMapBuffer); SetIndexBuffer(5,BufLastHigh); SetIndexBuffer(6,BufLastLow); //---- indicator short name IndicatorShortName("ZigZag_ws_Chanel("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")"); //---- initialization done return(0); } //+-------------------------------------------------------------------+ //| deinit | //+-------------------------------------------------------------------+ int deinit(){ int i,strlen,obj_total; string name; obj_total = ObjectsTotal(); strlen = StringLen(LabelName+"OBJ"); for(i=obj_total;i>=0;i--){ name = ObjectName(i); if(StringSubstr(name, 0, strlen) == LabelName+"OBJ") ObjectDelete(name); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i, counted_bars = IndicatorCounted(); int limit,counterZ,whatlookfor; int shift,back,lasthighpos,lastlowpos; double val,res; double curlow,curhigh,lasthigh,lastlow; if (counted_bars==0 && downloadhistory) // history was downloaded { ArrayInitialize(ZigzagBuffer,0.0); ArrayInitialize(BufChanelHigh,0.0); ArrayInitialize(BufChanelLow,0.0); ArrayInitialize(HighMapBuffer,0.0); ArrayInitialize(LowMapBuffer,0.0); } if (counted_bars==0) { limit=Bars-ExtDepth; downloadhistory=true; } if (counted_bars>0) { while (counterZ=0;i--) { ZigzagBuffer[i]=0.0; LowMapBuffer[i]=0.0; HighMapBuffer[i]=0.0; BufChanelHigh[i]=0.0; BufChanelLow[i]=0.0; } } for(shift=limit; shift>=0; shift--) { val=Low[iLowest(NULL,0,MODE_LOW,ExtDepth,shift)]; if(val==lastlow) val=0.0; else { lastlow=val; if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=LowMapBuffer[shift+back]; if((res!=0)&&(res>val)) LowMapBuffer[shift+back]=0.0; } } } if (Low[shift]==val) LowMapBuffer[shift]=val; else LowMapBuffer[shift]=0.0; //--- high val=High[iHighest(NULL,0,MODE_HIGH,ExtDepth,shift)]; if(val==lasthigh) val=0.0; else { lasthigh=val; if((val-High[shift])>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=HighMapBuffer[shift+back]; if((res!=0)&&(res =0;shift--) { res=0.0; switch(whatlookfor) { case 0: // look for peak or lawn if (lastlow==0 && lasthigh==0) { if (HighMapBuffer[shift]!=0) { lasthigh=High[shift]; lasthighpos=shift; whatlookfor=-1; SetHighZZ(shift, lasthigh); res=1; } if (LowMapBuffer[shift]!=0) { lastlow=Low[shift]; lastlowpos=shift; whatlookfor=1; SetLowZZ(shift, lastlow); res=1; } } break; case 1: // look for peak if (LowMapBuffer[shift]!=0.0 && LowMapBuffer[shift] lasthigh && LowMapBuffer[shift]==0.0) { SetHighZZ(lasthighpos, 0.0); lasthighpos=shift; lasthigh=HighMapBuffer[shift]; SetHighZZ(shift, lasthigh); } if (LowMapBuffer[shift]!=0.0 && HighMapBuffer[shift]==0.0) { lastlow=LowMapBuffer[shift]; lastlowpos=shift; SetLowZZ(shift, lastlow); whatlookfor=1; } break; default: return; } } double HH,HL; if(lasthigh<=3.00000&&lasthigh>=2.99000){HH=3.00000; HL=2.99000;} if(lasthigh<=2.99000&&lasthigh>=2.98000){HH=2.99000; HL=2.98000;} if(lasthigh<=2.98000&&lasthigh>=2.97000){HH=2.98000; HL=2.97000;} if(lasthigh<=2.97000&&lasthigh>=2.96000){HH=2.97000; HL=2.96000;} if(lasthigh<=2.96000&&lasthigh>=2.95000){HH=2.96000; HL=2.95000;} if(lasthigh<=2.95000&&lasthigh>=2.94000){HH=2.95000; HL=2.94000;} if(lasthigh<=2.94000&&lasthigh>=2.93000){HH=2.94000; HL=2.93000;} if(lasthigh<=2.93000&&lasthigh>=2.92000){HH=2.93000; HL=2.92000;} if(lasthigh<=2.92000&&lasthigh>=2.91000){HH=2.92000; HL=2.91000;} if(lasthigh<=2.91000&&lasthigh>=2.90000){HH=2.91000; HL=2.90000;} if(lasthigh<=2.90000&&lasthigh>=2.89000){HH=2.90000; HL=2.89000;} if(lasthigh<=2.89000&&lasthigh>=2.88000){HH=2.89000; HL=2.88000;} if(lasthigh<=2.88000&&lasthigh>=2.87000){HH=2.88000; HL=2.87000;} if(lasthigh<=2.87000&&lasthigh>=2.86000){HH=2.87000; HL=2.86000;} if(lasthigh<=2.86000&&lasthigh>=2.85000){HH=2.86000; HL=2.85000;} if(lasthigh<=2.85000&&lasthigh>=2.84000){HH=2.85000; HL=2.84000;} if(lasthigh<=2.84000&&lasthigh>=2.83000){HH=2.84000; HL=2.83000;} if(lasthigh<=2.83000&&lasthigh>=2.82000){HH=2.83000; HL=2.82000;} if(lasthigh<=2.82000&&lasthigh>=2.81000){HH=2.82000; HL=2.81000;} if(lasthigh<=2.81000&&lasthigh>=2.80000){HH=2.81000; HL=2.80000;} if(lasthigh<=2.80000&&lasthigh>=2.79000){HH=2.80000; HL=2.79000;} if(lasthigh<=2.79000&&lasthigh>=2.78000){HH=2.79000; HL=2.78000;} if(lasthigh<=2.78000&&lasthigh>=2.77000){HH=2.78000; HL=2.77000;} if(lasthigh<=2.77000&&lasthigh>=2.76000){HH=2.77000; HL=2.76000;} if(lasthigh<=2.76000&&lasthigh>=2.75000){HH=2.76000; HL=2.75000;} if(lasthigh<=2.75000&&lasthigh>=2.74000){HH=2.75000; HL=2.74000;} if(lasthigh<=2.74000&&lasthigh>=2.73000){HH=2.74000; HL=2.73000;} if(lasthigh<=2.73000&&lasthigh>=2.72000){HH=2.73000; HL=2.72000;} if(lasthigh<=2.72000&&lasthigh>=2.71000){HH=2.72000; HL=2.71000;} if(lasthigh<=2.71000&&lasthigh>=2.70000){HH=2.71000; HL=2.70000;} if(lasthigh<=2.70000&&lasthigh>=2.69000){HH=2.70000; HL=2.69000;} if(lasthigh<=2.69000&&lasthigh>=2.68000){HH=2.69000; HL=2.68000;} if(lasthigh<=2.68000&&lasthigh>=2.67000){HH=2.68000; HL=2.67000;} if(lasthigh<=2.67000&&lasthigh>=2.66000){HH=2.67000; HL=2.66000;} if(lasthigh<=2.66000&&lasthigh>=2.65000){HH=2.66000; HL=2.65000;} if(lasthigh<=2.65000&&lasthigh>=2.64000){HH=2.65000; HL=2.64000;} if(lasthigh<=2.64000&&lasthigh>=2.63000){HH=2.64000; HL=2.63000;} if(lasthigh<=2.63000&&lasthigh>=2.62000){HH=2.63000; HL=2.62000;} if(lasthigh<=2.62000&&lasthigh>=2.61000){HH=2.62000; HL=2.61000;} if(lasthigh<=2.61000&&lasthigh>=2.60000){HH=2.61000; HL=2.60000;} if(lasthigh<=2.60000&&lasthigh>=2.59000){HH=2.60000; HL=2.59000;} if(lasthigh<=2.59000&&lasthigh>=2.58000){HH=2.59000; HL=2.58000;} if(lasthigh<=2.58000&&lasthigh>=2.57000){HH=2.58000; HL=2.57000;} if(lasthigh<=2.57000&&lasthigh>=2.56000){HH=2.57000; HL=2.56000;} if(lasthigh<=2.56000&&lasthigh>=2.55000){HH=2.56000; HL=2.55000;} if(lasthigh<=2.55000&&lasthigh>=2.54000){HH=2.55000; HL=2.54000;} if(lasthigh<=2.54000&&lasthigh>=2.53000){HH=2.54000; HL=2.53000;} if(lasthigh<=2.53000&&lasthigh>=2.52000){HH=2.53000; HL=2.52000;} if(lasthigh<=2.52000&&lasthigh>=2.51000){HH=2.52000; HL=2.51000;} if(lasthigh<=2.51000&&lasthigh>=2.50000){HH=2.51000; HL=2.50000;} if(lasthigh<=2.50000&&lasthigh>=2.49000){HH=2.50000; HL=2.49000;} if(lasthigh<=2.49000&&lasthigh>=2.48000){HH=2.49000; HL=2.48000;} if(lasthigh<=2.48000&&lasthigh>=2.47000){HH=2.48000; HL=2.47000;} if(lasthigh<=2.47000&&lasthigh>=2.46000){HH=2.47000; HL=2.46000;} if(lasthigh<=2.46000&&lasthigh>=2.45000){HH=2.46000; HL=2.45000;} if(lasthigh<=2.45000&&lasthigh>=2.44000){HH=2.45000; HL=2.44000;} if(lasthigh<=2.44000&&lasthigh>=2.43000){HH=2.44000; HL=2.43000;} if(lasthigh<=2.43000&&lasthigh>=2.42000){HH=2.43000; HL=2.42000;} if(lasthigh<=2.42000&&lasthigh>=2.41000){HH=2.42000; HL=2.41000;} if(lasthigh<=2.41000&&lasthigh>=2.40000){HH=2.41000; HL=2.40000;} if(lasthigh<=2.40000&&lasthigh>=2.39000){HH=2.40000; HL=2.39000;} if(lasthigh<=2.39000&&lasthigh>=2.38000){HH=2.39000; HL=2.38000;} if(lasthigh<=2.38000&&lasthigh>=2.37000){HH=2.38000; HL=2.37000;} if(lasthigh<=2.37000&&lasthigh>=2.36000){HH=2.37000; HL=2.36000;} if(lasthigh<=2.36000&&lasthigh>=2.35000){HH=2.36000; HL=2.35000;} if(lasthigh<=2.35000&&lasthigh>=2.34000){HH=2.35000; HL=2.34000;} if(lasthigh<=2.34000&&lasthigh>=2.33000){HH=2.34000; HL=2.33000;} if(lasthigh<=2.33000&&lasthigh>=2.32000){HH=2.33000; HL=2.32000;} if(lasthigh<=2.32000&&lasthigh>=2.31000){HH=2.32000; HL=2.31000;} if(lasthigh<=2.31000&&lasthigh>=2.30000){HH=2.31000; HL=2.30000;} if(lasthigh<=2.30000&&lasthigh>=2.29000){HH=2.30000; HL=2.29000;} if(lasthigh<=2.29000&&lasthigh>=2.28000){HH=2.29000; HL=2.28000;} if(lasthigh<=2.28000&&lasthigh>=2.27000){HH=2.28000; HL=2.27000;} if(lasthigh<=2.27000&&lasthigh>=2.26000){HH=2.27000; HL=2.26000;} if(lasthigh<=2.26000&&lasthigh>=2.25000){HH=2.26000; HL=2.25000;} if(lasthigh<=2.25000&&lasthigh>=2.24000){HH=2.25000; HL=2.24000;} if(lasthigh<=2.24000&&lasthigh>=2.23000){HH=2.24000; HL=2.23000;} if(lasthigh<=2.23000&&lasthigh>=2.22000){HH=2.23000; HL=2.22000;} if(lasthigh<=2.22000&&lasthigh>=2.21000){HH=2.22000; HL=2.21000;} if(lasthigh<=2.21000&&lasthigh>=2.20000){HH=2.21000; HL=2.20000;} if(lasthigh<=2.20000&&lasthigh>=2.19000){HH=2.20000; HL=2.19000;} if(lasthigh<=2.19000&&lasthigh>=2.18000){HH=2.19000; HL=2.18000;} if(lasthigh<=2.18000&&lasthigh>=2.17000){HH=2.18000; HL=2.17000;} if(lasthigh<=2.17000&&lasthigh>=2.16000){HH=2.17000; HL=2.16000;} if(lasthigh<=2.16000&&lasthigh>=2.15000){HH=2.16000; HL=2.15000;} if(lasthigh<=2.15000&&lasthigh>=2.14000){HH=2.15000; HL=2.14000;} if(lasthigh<=2.14000&&lasthigh>=2.13000){HH=2.14000; HL=2.13000;} if(lasthigh<=2.13000&&lasthigh>=2.12000){HH=2.13000; HL=2.12000;} if(lasthigh<=2.12000&&lasthigh>=2.11000){HH=2.12000; HL=2.11000;} if(lasthigh<=2.11000&&lasthigh>=2.10000){HH=2.11000; HL=2.10000;} ///////////////////////////////////////////////////////////////// if(lasthigh<=2.00000&&lasthigh>=1.99000){HH=2.00000; HL=1.99000;} if(lasthigh<=1.99000&&lasthigh>=1.98000){HH=1.99000; HL=1.98000;} if(lasthigh<=1.98000&&lasthigh>=1.97000){HH=1.98000; HL=1.97000;} if(lasthigh<=1.97000&&lasthigh>=1.96000){HH=1.97000; HL=1.96000;} if(lasthigh<=1.96000&&lasthigh>=1.95000){HH=1.96000; HL=1.95000;} if(lasthigh<=1.95000&&lasthigh>=1.94000){HH=1.95000; HL=1.94000;} if(lasthigh<=1.94000&&lasthigh>=1.93000){HH=1.94000; HL=1.93000;} if(lasthigh<=1.93000&&lasthigh>=1.92000){HH=1.93000; HL=1.92000;} if(lasthigh<=1.92000&&lasthigh>=1.91000){HH=1.92000; HL=1.91000;} if(lasthigh<=1.91000&&lasthigh>=1.90000){HH=1.91000; HL=1.90000;} if(lasthigh<=1.90000&&lasthigh>=1.89000){HH=1.90000; HL=1.89000;} if(lasthigh<=1.89000&&lasthigh>=1.88000){HH=1.89000; HL=1.88000;} if(lasthigh<=1.88000&&lasthigh>=1.87000){HH=1.88000; HL=1.87000;} if(lasthigh<=1.87000&&lasthigh>=1.86000){HH=1.87000; HL=1.86000;} if(lasthigh<=1.86000&&lasthigh>=1.85000){HH=1.86000; HL=1.85000;} if(lasthigh<=1.85000&&lasthigh>=1.84000){HH=1.85000; HL=1.84000;} if(lasthigh<=1.84000&&lasthigh>=1.83000){HH=1.84000; HL=1.83000;} if(lasthigh<=1.83000&&lasthigh>=1.82000){HH=1.83000; HL=1.82000;} if(lasthigh<=1.82000&&lasthigh>=1.81000){HH=1.82000; HL=1.81000;} if(lasthigh<=1.81000&&lasthigh>=1.80000){HH=1.81000; HL=1.80000;} if(lasthigh<=1.80000&&lasthigh>=1.79000){HH=1.80000; HL=1.79000;} if(lasthigh<=1.79000&&lasthigh>=1.78000){HH=1.79000; HL=1.78000;} if(lasthigh<=1.78000&&lasthigh>=1.77000){HH=1.78000; HL=1.77000;} if(lasthigh<=1.77000&&lasthigh>=1.76000){HH=1.77000; HL=1.76000;} if(lasthigh<=1.76000&&lasthigh>=1.75000){HH=1.76000; HL=1.75000;} if(lasthigh<=1.75000&&lasthigh>=1.74000){HH=1.75000; HL=1.74000;} if(lasthigh<=1.74000&&lasthigh>=1.73000){HH=1.74000; HL=1.73000;} if(lasthigh<=1.73000&&lasthigh>=1.72000){HH=1.73000; HL=1.72000;} if(lasthigh<=1.72000&&lasthigh>=1.71000){HH=1.72000; HL=1.71000;} if(lasthigh<=1.71000&&lasthigh>=1.70000){HH=1.71000; HL=1.70000;} if(lasthigh<=1.70000&&lasthigh>=1.69000){HH=1.70000; HL=1.69000;} if(lasthigh<=1.69000&&lasthigh>=1.68000){HH=1.69000; HL=1.68000;} if(lasthigh<=1.68000&&lasthigh>=1.67000){HH=1.68000; HL=1.67000;} if(lasthigh<=1.67000&&lasthigh>=1.66000){HH=1.67000; HL=1.66000;} if(lasthigh<=1.66000&&lasthigh>=1.65000){HH=1.66000; HL=1.65000;} if(lasthigh<=1.65000&&lasthigh>=1.64000){HH=1.65000; HL=1.64000;} if(lasthigh<=1.64000&&lasthigh>=1.63000){HH=1.64000; HL=1.63000;} if(lasthigh<=1.63000&&lasthigh>=1.62000){HH=1.63000; HL=1.62000;} if(lasthigh<=1.62000&&lasthigh>=1.61000){HH=1.62000; HL=1.61000;} if(lasthigh<=1.61000&&lasthigh>=1.60000){HH=1.61000; HL=1.60000;} if(lasthigh<=1.60000&&lasthigh>=1.59000){HH=1.60000; HL=1.59000;} if(lasthigh<=1.59000&&lasthigh>=1.58000){HH=1.59000; HL=1.58000;} if(lasthigh<=1.58000&&lasthigh>=1.57000){HH=1.58000; HL=1.57000;} if(lasthigh<=1.57000&&lasthigh>=1.56000){HH=1.57000; HL=1.56000;} if(lasthigh<=1.56000&&lasthigh>=1.55000){HH=1.56000; HL=1.55000;} if(lasthigh<=1.55000&&lasthigh>=1.54000){HH=1.55000; HL=1.54000;} if(lasthigh<=1.54000&&lasthigh>=1.53000){HH=1.54000; HL=1.53000;} if(lasthigh<=1.53000&&lasthigh>=1.52000){HH=1.53000; HL=1.52000;} if(lasthigh<=1.52000&&lasthigh>=1.51000){HH=1.52000; HL=1.51000;} if(lasthigh<=1.51000&&lasthigh>=1.50000){HH=1.51000; HL=1.50000;} if(lasthigh<=1.50000&&lasthigh>=1.49000){HH=1.50000; HL=1.49000;} if(lasthigh<=1.49000&&lasthigh>=1.48000){HH=1.49000; HL=1.48000;} if(lasthigh<=1.48000&&lasthigh>=1.47000){HH=1.48000; HL=1.47000;} if(lasthigh<=1.47000&&lasthigh>=1.46000){HH=1.47000; HL=1.46000;} if(lasthigh<=1.46000&&lasthigh>=1.45000){HH=1.46000; HL=1.45000;} if(lasthigh<=1.45000&&lasthigh>=1.44000){HH=1.45000; HL=1.44000;} if(lasthigh<=1.44000&&lasthigh>=1.43000){HH=1.44000; HL=1.43000;} if(lasthigh<=1.43000&&lasthigh>=1.42000){HH=1.43000; HL=1.42000;} if(lasthigh<=1.42000&&lasthigh>=1.41000){HH=1.42000; HL=1.41000;} if(lasthigh<=1.41000&&lasthigh>=1.40000){HH=1.41000; HL=1.40000;} if(lasthigh<=1.40000&&lasthigh>=1.39000){HH=1.40000; HL=1.39000;} if(lasthigh<=1.39000&&lasthigh>=1.38000){HH=1.39000; HL=1.38000;} if(lasthigh<=1.38000&&lasthigh>=1.37000){HH=1.38000; HL=1.37000;} if(lasthigh<=1.37000&&lasthigh>=1.36000){HH=1.37000; HL=1.36000;} if(lasthigh<=1.36000&&lasthigh>=1.35000){HH=1.36000; HL=1.35000;} if(lasthigh<=1.35000&&lasthigh>=1.34000){HH=1.35000; HL=1.34000;} if(lasthigh<=1.34000&&lasthigh>=1.33000){HH=1.34000; HL=1.33000;} if(lasthigh<=1.33000&&lasthigh>=1.32000){HH=1.33000; HL=1.32000;} if(lasthigh<=1.32000&&lasthigh>=1.31000){HH=1.32000; HL=1.31000;} if(lasthigh<=1.31000&&lasthigh>=1.30000){HH=1.31000; HL=1.30000;} if(lasthigh<=1.30000&&lasthigh>=1.29000){HH=1.30000; HL=1.29000;} if(lasthigh<=1.29000&&lasthigh>=1.28000){HH=1.29000; HL=1.28000;} if(lasthigh<=1.28000&&lasthigh>=1.27000){HH=1.28000; HL=1.27000;} if(lasthigh<=1.27000&&lasthigh>=1.26000){HH=1.27000; HL=1.26000;} if(lasthigh<=1.26000&&lasthigh>=1.25000){HH=1.26000; HL=1.25000;} if(lasthigh<=1.25000&&lasthigh>=1.24000){HH=1.25000; HL=1.24000;} if(lasthigh<=1.24000&&lasthigh>=1.23000){HH=1.24000; HL=1.23000;} if(lasthigh<=1.23000&&lasthigh>=1.22000){HH=1.23000; HL=1.22000;} if(lasthigh<=1.22000&&lasthigh>=1.21000){HH=1.22000; HL=1.21000;} if(lasthigh<=1.21000&&lasthigh>=1.20000){HH=1.21000; HL=1.20000;} if(lasthigh<=1.20000&&lasthigh>=1.19000){HH=1.20000; HL=1.19000;} if(lasthigh<=1.19000&&lasthigh>=1.18000){HH=1.19000; HL=1.18000;} if(lasthigh<=1.18000&&lasthigh>=1.17000){HH=1.18000; HL=1.17000;} if(lasthigh<=1.17000&&lasthigh>=1.16000){HH=1.17000; HL=1.16000;} if(lasthigh<=1.16000&&lasthigh>=1.15000){HH=1.16000; HL=1.15000;} if(lasthigh<=1.15000&&lasthigh>=1.14000){HH=1.15000; HL=1.14000;} if(lasthigh<=1.14000&&lasthigh>=1.13000){HH=1.14000; HL=1.13000;} if(lasthigh<=1.13000&&lasthigh>=1.12000){HH=1.13000; HL=1.12000;} if(lasthigh<=1.12000&&lasthigh>=1.11000){HH=1.12000; HL=1.11000;} if(lasthigh<=1.11000&&lasthigh>=1.10000){HH=1.11000; HL=1.10000;} ///////////////////////////////////////////////////////////////// if(lasthigh<=1.00000&&lasthigh>=0.99000){HH=1.00000; HL=0.99000;} if(lasthigh<=0.99000&&lasthigh>=0.98000){HH=0.99000; HL=0.98000;} if(lasthigh<=0.98000&&lasthigh>=0.97000){HH=0.98000; HL=0.97000;} if(lasthigh<=0.97000&&lasthigh>=0.96000){HH=0.97000; HL=0.96000;} if(lasthigh<=0.96000&&lasthigh>=0.95000){HH=0.96000; HL=0.95000;} if(lasthigh<=0.95000&&lasthigh>=0.94000){HH=0.95000; HL=0.94000;} if(lasthigh<=0.94000&&lasthigh>=0.93000){HH=0.94000; HL=0.93000;} if(lasthigh<=0.93000&&lasthigh>=0.92000){HH=0.93000; HL=0.92000;} if(lasthigh<=0.92000&&lasthigh>=0.91000){HH=0.92000; HL=0.91000;} if(lasthigh<=0.91000&&lasthigh>=0.90000){HH=0.91000; HL=0.90000;} if(lasthigh<=0.90000&&lasthigh>=0.89000){HH=0.90000; HL=0.89000;} if(lasthigh<=0.89000&&lasthigh>=0.88000){HH=0.89000; HL=0.88000;} if(lasthigh<=0.88000&&lasthigh>=0.87000){HH=0.88000; HL=0.87000;} if(lasthigh<=0.87000&&lasthigh>=0.86000){HH=0.87000; HL=0.86000;} if(lasthigh<=0.86000&&lasthigh>=0.85000){HH=0.86000; HL=0.85000;} if(lasthigh<=0.85000&&lasthigh>=0.84000){HH=0.85000; HL=0.84000;} if(lasthigh<=0.84000&&lasthigh>=0.83000){HH=0.84000; HL=0.83000;} if(lasthigh<=0.83000&&lasthigh>=0.82000){HH=0.83000; HL=0.82000;} if(lasthigh<=0.82000&&lasthigh>=0.81000){HH=0.82000; HL=0.81000;} if(lasthigh<=0.81000&&lasthigh>=0.80000){HH=0.81000; HL=0.80000;} if(lasthigh<=0.80000&&lasthigh>=0.79000){HH=0.80000; HL=0.79000;} if(lasthigh<=0.79000&&lasthigh>=0.78000){HH=0.79000; HL=0.78000;} if(lasthigh<=0.78000&&lasthigh>=0.77000){HH=0.78000; HL=0.77000;} if(lasthigh<=0.77000&&lasthigh>=0.76000){HH=0.77000; HL=0.76000;} if(lasthigh<=0.76000&&lasthigh>=0.75000){HH=0.76000; HL=0.75000;} if(lasthigh<=0.75000&&lasthigh>=0.74000){HH=0.75000; HL=0.74000;} if(lasthigh<=0.74000&&lasthigh>=0.73000){HH=0.74000; HL=0.73000;} if(lasthigh<=0.73000&&lasthigh>=0.72000){HH=0.73000; HL=0.72000;} if(lasthigh<=0.72000&&lasthigh>=0.71000){HH=0.72000; HL=0.71000;} if(lasthigh<=0.71000&&lasthigh>=0.70000){HH=0.71000; HL=0.70000;} if(lasthigh<=0.70000&&lasthigh>=0.69000){HH=0.70000; HL=0.69000;} if(lasthigh<=0.69000&&lasthigh>=0.68000){HH=0.69000; HL=0.68000;} if(lasthigh<=0.68000&&lasthigh>=0.67000){HH=0.68000; HL=0.67000;} if(lasthigh<=0.67000&&lasthigh>=0.66000){HH=0.67000; HL=0.66000;} if(lasthigh<=0.66000&&lasthigh>=0.65000){HH=0.66000; HL=0.65000;} if(lasthigh<=0.65000&&lasthigh>=0.64000){HH=0.65000; HL=0.64000;} if(lasthigh<=0.64000&&lasthigh>=0.63000){HH=0.64000; HL=0.63000;} if(lasthigh<=0.63000&&lasthigh>=0.62000){HH=0.63000; HL=0.62000;} if(lasthigh<=0.62000&&lasthigh>=0.61000){HH=0.62000; HL=0.61000;} if(lasthigh<=0.61000&&lasthigh>=0.60000){HH=0.61000; HL=0.60000;} if(lasthigh<=0.60000&&lasthigh>=0.59000){HH=0.60000; HL=0.59000;} if(lasthigh<=0.59000&&lasthigh>=0.58000){HH=0.59000; HL=0.58000;} if(lasthigh<=0.58000&&lasthigh>=0.57000){HH=0.58000; HL=0.57000;} if(lasthigh<=0.57000&&lasthigh>=0.56000){HH=0.57000; HL=0.56000;} if(lasthigh<=0.56000&&lasthigh>=0.55000){HH=0.56000; HL=0.55000;} if(lasthigh<=0.55000&&lasthigh>=0.54000){HH=0.55000; HL=0.54000;} if(lasthigh<=0.54000&&lasthigh>=0.53000){HH=0.54000; HL=0.53000;} if(lasthigh<=0.53000&&lasthigh>=0.52000){HH=0.53000; HL=0.52000;} if(lasthigh<=0.52000&&lasthigh>=0.51000){HH=0.52000; HL=0.51000;} if(lasthigh<=0.51000&&lasthigh>=0.50000){HH=0.51000; HL=0.50000;} if(lasthigh<=0.50000&&lasthigh>=0.49000){HH=0.50000; HL=0.49000;} if(lasthigh<=0.49000&&lasthigh>=0.48000){HH=0.49000; HL=0.48000;} if(lasthigh<=0.48000&&lasthigh>=0.47000){HH=0.48000; HL=0.47000;} if(lasthigh<=0.47000&&lasthigh>=0.46000){HH=0.47000; HL=0.46000;} if(lasthigh<=0.46000&&lasthigh>=0.45000){HH=0.46000; HL=0.45000;} if(lasthigh<=0.45000&&lasthigh>=0.44000){HH=0.45000; HL=0.44000;} if(lasthigh<=0.44000&&lasthigh>=0.43000){HH=0.44000; HL=0.43000;} if(lasthigh<=0.43000&&lasthigh>=0.42000){HH=0.43000; HL=0.42000;} if(lasthigh<=0.42000&&lasthigh>=0.41000){HH=0.42000; HL=0.41000;} if(lasthigh<=0.41000&&lasthigh>=0.40000){HH=0.41000; HL=0.40000;} if(lasthigh<=0.40000&&lasthigh>=0.39000){HH=0.40000; HL=0.39000;} if(lasthigh<=0.39000&&lasthigh>=0.38000){HH=0.39000; HL=0.38000;} if(lasthigh<=0.38000&&lasthigh>=0.37000){HH=0.38000; HL=0.37000;} if(lasthigh<=0.37000&&lasthigh>=0.36000){HH=0.37000; HL=0.36000;} if(lasthigh<=0.36000&&lasthigh>=0.35000){HH=0.36000; HL=0.35000;} if(lasthigh<=0.35000&&lasthigh>=0.34000){HH=0.35000; HL=0.34000;} if(lasthigh<=0.34000&&lasthigh>=0.33000){HH=0.34000; HL=0.33000;} if(lasthigh<=0.33000&&lasthigh>=0.32000){HH=0.33000; HL=0.32000;} if(lasthigh<=0.32000&&lasthigh>=0.31000){HH=0.32000; HL=0.31000;} if(lasthigh<=0.31000&&lasthigh>=0.30000){HH=0.31000; HL=0.30000;} if(lasthigh<=0.30000&&lasthigh>=0.29000){HH=0.30000; HL=0.29000;} if(lasthigh<=0.29000&&lasthigh>=0.28000){HH=0.29000; HL=0.28000;} if(lasthigh<=0.28000&&lasthigh>=0.27000){HH=0.28000; HL=0.27000;} if(lasthigh<=0.27000&&lasthigh>=0.26000){HH=0.27000; HL=0.26000;} if(lasthigh<=0.26000&&lasthigh>=0.25000){HH=0.26000; HL=0.25000;} if(lasthigh<=0.25000&&lasthigh>=0.24000){HH=0.25000; HL=0.24000;} if(lasthigh<=0.24000&&lasthigh>=0.23000){HH=0.24000; HL=0.23000;} if(lasthigh<=0.23000&&lasthigh>=0.22000){HH=0.23000; HL=0.22000;} if(lasthigh<=0.22000&&lasthigh>=0.21000){HH=0.22000; HL=0.21000;} if(lasthigh<=0.21000&&lasthigh>=0.20000){HH=0.21000; HL=0.20000;} if(lasthigh<=0.20000&&lasthigh>=0.19000){HH=0.20000; HL=0.19000;} if(lasthigh<=0.19000&&lasthigh>=0.18000){HH=0.19000; HL=0.18000;} if(lasthigh<=0.18000&&lasthigh>=0.17000){HH=0.18000; HL=0.17000;} if(lasthigh<=0.17000&&lasthigh>=0.16000){HH=0.17000; HL=0.16000;} if(lasthigh<=0.16000&&lasthigh>=0.15000){HH=0.16000; HL=0.15000;} if(lasthigh<=0.15000&&lasthigh>=0.14000){HH=0.15000; HL=0.14000;} if(lasthigh<=0.14000&&lasthigh>=0.13000){HH=0.14000; HL=0.13000;} if(lasthigh<=0.13000&&lasthigh>=0.12000){HH=0.13000; HL=0.12000;} if(lasthigh<=0.12000&&lasthigh>=0.11000){HH=0.12000; HL=0.11000;} if(lasthigh<=0.11000&&lasthigh>=0.10000){HH=0.11000; HL=0.10000;} ///////////////////////////////////////////////////////////////////// SET_RectangleRES("OBJRESAREA", Time[lasthighpos], HH,Time[0] + Period()*60*0, HL, Green); double LH,LL; if(lastlow<=3.00000&&lastlow>=2.99000){LH=3.00000; LL=2.99000;} if(lastlow<=2.99000&&lastlow>=2.98000){LH=2.99000; LL=2.98000;} if(lastlow<=2.98000&&lastlow>=2.97000){LH=2.98000; LL=2.97000;} if(lastlow<=2.97000&&lastlow>=2.96000){LH=2.97000; LL=2.96000;} if(lastlow<=2.96000&&lastlow>=2.95000){LH=2.96000; LL=2.95000;} if(lastlow<=2.95000&&lastlow>=2.94000){LH=2.95000; LL=2.94000;} if(lastlow<=2.94000&&lastlow>=2.93000){LH=2.94000; LL=2.93000;} if(lastlow<=2.93000&&lastlow>=2.92000){LH=2.93000; LL=2.92000;} if(lastlow<=2.92000&&lastlow>=2.91000){LH=2.92000; LL=2.91000;} if(lastlow<=2.91000&&lastlow>=2.90000){LH=2.91000; LL=2.90000;} if(lastlow<=2.90000&&lastlow>=2.89000){LH=2.90000; LL=2.89000;} if(lastlow<=2.89000&&lastlow>=2.88000){LH=2.89000; LL=2.88000;} if(lastlow<=2.88000&&lastlow>=2.87000){LH=2.88000; LL=2.87000;} if(lastlow<=2.87000&&lastlow>=2.86000){LH=2.87000; LL=2.86000;} if(lastlow<=2.86000&&lastlow>=2.85000){LH=2.86000; LL=2.85000;} if(lastlow<=2.85000&&lastlow>=2.84000){LH=2.85000; LL=2.84000;} if(lastlow<=2.84000&&lastlow>=2.83000){LH=2.84000; LL=2.83000;} if(lastlow<=2.83000&&lastlow>=2.82000){LH=2.83000; LL=2.82000;} if(lastlow<=2.82000&&lastlow>=2.81000){LH=2.82000; LL=2.81000;} if(lastlow<=2.81000&&lastlow>=2.80000){LH=2.81000; LL=2.80000;} if(lastlow<=2.80000&&lastlow>=2.79000){LH=2.80000; LL=2.79000;} if(lastlow<=2.79000&&lastlow>=2.78000){LH=2.79000; LL=2.78000;} if(lastlow<=2.78000&&lastlow>=2.77000){LH=2.78000; LL=2.77000;} if(lastlow<=2.77000&&lastlow>=2.76000){LH=2.77000; LL=2.76000;} if(lastlow<=2.76000&&lastlow>=2.75000){LH=2.76000; LL=2.75000;} if(lastlow<=2.75000&&lastlow>=2.74000){LH=2.75000; LL=2.74000;} if(lastlow<=2.74000&&lastlow>=2.73000){LH=2.74000; LL=2.73000;} if(lastlow<=2.73000&&lastlow>=2.72000){LH=2.73000; LL=2.72000;} if(lastlow<=2.72000&&lastlow>=2.71000){LH=2.72000; LL=2.71000;} if(lastlow<=2.71000&&lastlow>=2.70000){LH=2.71000; LL=2.70000;} if(lastlow<=2.70000&&lastlow>=2.69000){LH=2.70000; LL=2.69000;} if(lastlow<=2.69000&&lastlow>=2.68000){LH=2.69000; LL=2.68000;} if(lastlow<=2.68000&&lastlow>=2.67000){LH=2.68000; LL=2.67000;} if(lastlow<=2.67000&&lastlow>=2.66000){LH=2.67000; LL=2.66000;} if(lastlow<=2.66000&&lastlow>=2.65000){LH=2.66000; LL=2.65000;} if(lastlow<=2.65000&&lastlow>=2.64000){LH=2.65000; LL=2.64000;} if(lastlow<=2.64000&&lastlow>=2.63000){LH=2.64000; LL=2.63000;} if(lastlow<=2.63000&&lastlow>=2.62000){LH=2.63000; LL=2.62000;} if(lastlow<=2.62000&&lastlow>=2.61000){LH=2.62000; LL=2.61000;} if(lastlow<=2.61000&&lastlow>=2.60000){LH=2.61000; LL=2.60000;} if(lastlow<=2.60000&&lastlow>=2.59000){LH=2.60000; LL=2.59000;} if(lastlow<=2.59000&&lastlow>=2.58000){LH=2.59000; LL=2.58000;} if(lastlow<=2.58000&&lastlow>=2.57000){LH=2.58000; LL=2.57000;} if(lastlow<=2.57000&&lastlow>=2.56000){LH=2.57000; LL=2.56000;} if(lastlow<=2.56000&&lastlow>=2.55000){LH=2.56000; LL=2.55000;} if(lastlow<=2.55000&&lastlow>=2.54000){LH=2.55000; LL=2.54000;} if(lastlow<=2.54000&&lastlow>=2.53000){LH=2.54000; LL=2.53000;} if(lastlow<=2.53000&&lastlow>=2.52000){LH=2.53000; LL=2.52000;} if(lastlow<=2.52000&&lastlow>=2.51000){LH=2.52000; LL=2.51000;} if(lastlow<=2.51000&&lastlow>=2.50000){LH=2.51000; LL=2.50000;} if(lastlow<=2.50000&&lastlow>=2.49000){LH=2.50000; LL=2.49000;} if(lastlow<=2.49000&&lastlow>=2.48000){LH=2.49000; LL=2.48000;} if(lastlow<=2.48000&&lastlow>=2.47000){LH=2.48000; LL=2.47000;} if(lastlow<=2.47000&&lastlow>=2.46000){LH=2.47000; LL=2.46000;} if(lastlow<=2.46000&&lastlow>=2.45000){LH=2.46000; LL=2.45000;} if(lastlow<=2.45000&&lastlow>=2.44000){LH=2.45000; LL=2.44000;} if(lastlow<=2.44000&&lastlow>=2.43000){LH=2.44000; LL=2.43000;} if(lastlow<=2.43000&&lastlow>=2.42000){LH=2.43000; LL=2.42000;} if(lastlow<=2.42000&&lastlow>=2.41000){LH=2.42000; LL=2.41000;} if(lastlow<=2.41000&&lastlow>=2.40000){LH=2.41000; LL=2.40000;} if(lastlow<=2.40000&&lastlow>=2.39000){LH=2.40000; LL=2.39000;} if(lastlow<=2.39000&&lastlow>=2.38000){LH=2.39000; LL=2.38000;} if(lastlow<=2.38000&&lastlow>=2.37000){LH=2.38000; LL=2.37000;} if(lastlow<=2.37000&&lastlow>=2.36000){LH=2.37000; LL=2.36000;} if(lastlow<=2.36000&&lastlow>=2.35000){LH=2.36000; LL=2.35000;} if(lastlow<=2.35000&&lastlow>=2.34000){LH=2.35000; LL=2.34000;} if(lastlow<=2.34000&&lastlow>=2.33000){LH=2.34000; LL=2.33000;} if(lastlow<=2.33000&&lastlow>=2.32000){LH=2.33000; LL=2.32000;} if(lastlow<=2.32000&&lastlow>=2.31000){LH=2.32000; LL=2.31000;} if(lastlow<=2.31000&&lastlow>=2.30000){LH=2.31000; LL=2.30000;} if(lastlow<=2.30000&&lastlow>=2.29000){LH=2.30000; LL=2.29000;} if(lastlow<=2.29000&&lastlow>=2.28000){LH=2.29000; LL=2.28000;} if(lastlow<=2.28000&&lastlow>=2.27000){LH=2.28000; LL=2.27000;} if(lastlow<=2.27000&&lastlow>=2.26000){LH=2.27000; LL=2.26000;} if(lastlow<=2.26000&&lastlow>=2.25000){LH=2.26000; LL=2.25000;} if(lastlow<=2.25000&&lastlow>=2.24000){LH=2.25000; LL=2.24000;} if(lastlow<=2.24000&&lastlow>=2.23000){LH=2.24000; LL=2.23000;} if(lastlow<=2.23000&&lastlow>=2.22000){LH=2.23000; LL=2.22000;} if(lastlow<=2.22000&&lastlow>=2.21000){LH=2.22000; LL=2.21000;} if(lastlow<=2.21000&&lastlow>=2.20000){LH=2.21000; LL=2.20000;} if(lastlow<=2.20000&&lastlow>=2.19000){LH=2.20000; LL=2.19000;} if(lastlow<=2.19000&&lastlow>=2.18000){LH=2.19000; LL=2.18000;} if(lastlow<=2.18000&&lastlow>=2.17000){LH=2.18000; LL=2.17000;} if(lastlow<=2.17000&&lastlow>=2.16000){LH=2.17000; LL=2.16000;} if(lastlow<=2.16000&&lastlow>=2.15000){LH=2.16000; LL=2.15000;} if(lastlow<=2.15000&&lastlow>=2.14000){LH=2.15000; LL=2.14000;} if(lastlow<=2.14000&&lastlow>=2.13000){LH=2.14000; LL=2.13000;} if(lastlow<=2.13000&&lastlow>=2.12000){LH=2.13000; LL=2.12000;} if(lastlow<=2.12000&&lastlow>=2.11000){LH=2.12000; LL=2.11000;} if(lastlow<=2.11000&&lastlow>=2.10000){LH=2.11000; LL=2.10000;} ///////////////////////////////////////////////////////////////// if(lastlow<=2.00000&&lastlow>=1.99000){LH=2.00000; LL=1.99000;} if(lastlow<=1.99000&&lastlow>=1.98000){LH=1.99000; LL=1.98000;} if(lastlow<=1.98000&&lastlow>=1.97000){LH=1.98000; LL=1.97000;} if(lastlow<=1.97000&&lastlow>=1.96000){LH=1.97000; LL=1.96000;} if(lastlow<=1.96000&&lastlow>=1.95000){LH=1.96000; LL=1.95000;} if(lastlow<=1.95000&&lastlow>=1.94000){LH=1.95000; LL=1.94000;} if(lastlow<=1.94000&&lastlow>=1.93000){LH=1.94000; LL=1.93000;} if(lastlow<=1.93000&&lastlow>=1.92000){LH=1.93000; LL=1.92000;} if(lastlow<=1.92000&&lastlow>=1.91000){LH=1.92000; LL=1.91000;} if(lastlow<=1.91000&&lastlow>=1.90000){LH=1.91000; LL=1.90000;} if(lastlow<=1.90000&&lastlow>=1.89000){LH=1.90000; LL=1.89000;} if(lastlow<=1.89000&&lastlow>=1.88000){LH=1.89000; LL=1.88000;} if(lastlow<=1.88000&&lastlow>=1.87000){LH=1.88000; LL=1.87000;} if(lastlow<=1.87000&&lastlow>=1.86000){LH=1.87000; LL=1.86000;} if(lastlow<=1.86000&&lastlow>=1.85000){LH=1.86000; LL=1.85000;} if(lastlow<=1.85000&&lastlow>=1.84000){LH=1.85000; LL=1.84000;} if(lastlow<=1.84000&&lastlow>=1.83000){LH=1.84000; LL=1.83000;} if(lastlow<=1.83000&&lastlow>=1.82000){LH=1.83000; LL=1.82000;} if(lastlow<=1.82000&&lastlow>=1.81000){LH=1.82000; LL=1.81000;} if(lastlow<=1.81000&&lastlow>=1.80000){LH=1.81000; LL=1.80000;} if(lastlow<=1.80000&&lastlow>=1.79000){LH=1.80000; LL=1.79000;} if(lastlow<=1.79000&&lastlow>=1.78000){LH=1.79000; LL=1.78000;} if(lastlow<=1.78000&&lastlow>=1.77000){LH=1.78000; LL=1.77000;} if(lastlow<=1.77000&&lastlow>=1.76000){LH=1.77000; LL=1.76000;} if(lastlow<=1.76000&&lastlow>=1.75000){LH=1.76000; LL=1.75000;} if(lastlow<=1.75000&&lastlow>=1.74000){LH=1.75000; LL=1.74000;} if(lastlow<=1.74000&&lastlow>=1.73000){LH=1.74000; LL=1.73000;} if(lastlow<=1.73000&&lastlow>=1.72000){LH=1.73000; LL=1.72000;} if(lastlow<=1.72000&&lastlow>=1.71000){LH=1.72000; LL=1.71000;} if(lastlow<=1.71000&&lastlow>=1.70000){LH=1.71000; LL=1.70000;} if(lastlow<=1.70000&&lastlow>=1.69000){LH=1.70000; LL=1.69000;} if(lastlow<=1.69000&&lastlow>=1.68000){LH=1.69000; LL=1.68000;} if(lastlow<=1.68000&&lastlow>=1.67000){LH=1.68000; LL=1.67000;} if(lastlow<=1.67000&&lastlow>=1.66000){LH=1.67000; LL=1.66000;} if(lastlow<=1.66000&&lastlow>=1.65000){LH=1.66000; LL=1.65000;} if(lastlow<=1.65000&&lastlow>=1.64000){LH=1.65000; LL=1.64000;} if(lastlow<=1.64000&&lastlow>=1.63000){LH=1.64000; LL=1.63000;} if(lastlow<=1.63000&&lastlow>=1.62000){LH=1.63000; LL=1.62000;} if(lastlow<=1.62000&&lastlow>=1.61000){LH=1.62000; LL=1.61000;} if(lastlow<=1.61000&&lastlow>=1.60000){LH=1.61000; LL=1.60000;} if(lastlow<=1.60000&&lastlow>=1.59000){LH=1.60000; LL=1.59000;} if(lastlow<=1.59000&&lastlow>=1.58000){LH=1.59000; LL=1.58000;} if(lastlow<=1.58000&&lastlow>=1.57000){LH=1.58000; LL=1.57000;} if(lastlow<=1.57000&&lastlow>=1.56000){LH=1.57000; LL=1.56000;} if(lastlow<=1.56000&&lastlow>=1.55000){LH=1.56000; LL=1.55000;} if(lastlow<=1.55000&&lastlow>=1.54000){LH=1.55000; LL=1.54000;} if(lastlow<=1.54000&&lastlow>=1.53000){LH=1.54000; LL=1.53000;} if(lastlow<=1.53000&&lastlow>=1.52000){LH=1.53000; LL=1.52000;} if(lastlow<=1.52000&&lastlow>=1.51000){LH=1.52000; LL=1.51000;} if(lastlow<=1.51000&&lastlow>=1.50000){LH=1.51000; LL=1.50000;} if(lastlow<=1.50000&&lastlow>=1.49000){LH=1.50000; LL=1.49000;} if(lastlow<=1.49000&&lastlow>=1.48000){LH=1.49000; LL=1.48000;} if(lastlow<=1.48000&&lastlow>=1.47000){LH=1.48000; LL=1.47000;} if(lastlow<=1.47000&&lastlow>=1.46000){LH=1.47000; LL=1.46000;} if(lastlow<=1.46000&&lastlow>=1.45000){LH=1.46000; LL=1.45000;} if(lastlow<=1.45000&&lastlow>=1.44000){LH=1.45000; LL=1.44000;} if(lastlow<=1.44000&&lastlow>=1.43000){LH=1.44000; LL=1.43000;} if(lastlow<=1.43000&&lastlow>=1.42000){LH=1.43000; LL=1.42000;} if(lastlow<=1.42000&&lastlow>=1.41000){LH=1.42000; LL=1.41000;} if(lastlow<=1.41000&&lastlow>=1.40000){LH=1.41000; LL=1.40000;} if(lastlow<=1.40000&&lastlow>=1.39000){LH=1.40000; LL=1.39000;} if(lastlow<=1.39000&&lastlow>=1.38000){LH=1.39000; LL=1.38000;} if(lastlow<=1.38000&&lastlow>=1.37000){LH=1.38000; LL=1.37000;} if(lastlow<=1.37000&&lastlow>=1.36000){LH=1.37000; LL=1.36000;} if(lastlow<=1.36000&&lastlow>=1.35000){LH=1.36000; LL=1.35000;} if(lastlow<=1.35000&&lastlow>=1.34000){LH=1.35000; LL=1.34000;} if(lastlow<=1.34000&&lastlow>=1.33000){LH=1.34000; LL=1.33000;} if(lastlow<=1.33000&&lastlow>=1.32000){LH=1.33000; LL=1.32000;} if(lastlow<=1.32000&&lastlow>=1.31000){LH=1.32000; LL=1.31000;} if(lastlow<=1.31000&&lastlow>=1.30000){LH=1.31000; LL=1.30000;} if(lastlow<=1.30000&&lastlow>=1.29000){LH=1.30000; LL=1.29000;} if(lastlow<=1.29000&&lastlow>=1.28000){LH=1.29000; LL=1.28000;} if(lastlow<=1.28000&&lastlow>=1.27000){LH=1.28000; LL=1.27000;} if(lastlow<=1.27000&&lastlow>=1.26000){LH=1.27000; LL=1.26000;} if(lastlow<=1.26000&&lastlow>=1.25000){LH=1.26000; LL=1.25000;} if(lastlow<=1.25000&&lastlow>=1.24000){LH=1.25000; LL=1.24000;} if(lastlow<=1.24000&&lastlow>=1.23000){LH=1.24000; LL=1.23000;} if(lastlow<=1.23000&&lastlow>=1.22000){LH=1.23000; LL=1.22000;} if(lastlow<=1.22000&&lastlow>=1.21000){LH=1.22000; LL=1.21000;} if(lastlow<=1.21000&&lastlow>=1.20000){LH=1.21000; LL=1.20000;} if(lastlow<=1.20000&&lastlow>=1.19000){LH=1.20000; LL=1.19000;} if(lastlow<=1.19000&&lastlow>=1.18000){LH=1.19000; LL=1.18000;} if(lastlow<=1.18000&&lastlow>=1.17000){LH=1.18000; LL=1.17000;} if(lastlow<=1.17000&&lastlow>=1.16000){LH=1.17000; LL=1.16000;} if(lastlow<=1.16000&&lastlow>=1.15000){LH=1.16000; LL=1.15000;} if(lastlow<=1.15000&&lastlow>=1.14000){LH=1.15000; LL=1.14000;} if(lastlow<=1.14000&&lastlow>=1.13000){LH=1.14000; LL=1.13000;} if(lastlow<=1.13000&&lastlow>=1.12000){LH=1.13000; LL=1.12000;} if(lastlow<=1.12000&&lastlow>=1.11000){LH=1.12000; LL=1.11000;} if(lastlow<=1.11000&&lastlow>=1.10000){LH=1.11000; LL=1.10000;} ///////////////////////////////////////////////////////////////// if(lastlow<=1.00000&&lastlow>=0.99000){LH=1.00000; LL=0.99000;} if(lastlow<=0.99000&&lastlow>=0.98000){LH=0.99000; LL=0.98000;} if(lastlow<=0.98000&&lastlow>=0.97000){LH=0.98000; LL=0.97000;} if(lastlow<=0.97000&&lastlow>=0.96000){LH=0.97000; LL=0.96000;} if(lastlow<=0.96000&&lastlow>=0.95000){LH=0.96000; LL=0.95000;} if(lastlow<=0.95000&&lastlow>=0.94000){LH=0.95000; LL=0.94000;} if(lastlow<=0.94000&&lastlow>=0.93000){LH=0.94000; LL=0.93000;} if(lastlow<=0.93000&&lastlow>=0.92000){LH=0.93000; LL=0.92000;} if(lastlow<=0.92000&&lastlow>=0.91000){LH=0.92000; LL=0.91000;} if(lastlow<=0.91000&&lastlow>=0.90000){LH=0.91000; LL=0.90000;} if(lastlow<=0.90000&&lastlow>=0.89000){LH=0.90000; LL=0.89000;} if(lastlow<=0.89000&&lastlow>=0.88000){LH=0.89000; LL=0.88000;} if(lastlow<=0.88000&&lastlow>=0.87000){LH=0.88000; LL=0.87000;} if(lastlow<=0.87000&&lastlow>=0.86000){LH=0.87000; LL=0.86000;} if(lastlow<=0.86000&&lastlow>=0.85000){LH=0.86000; LL=0.85000;} if(lastlow<=0.85000&&lastlow>=0.84000){LH=0.85000; LL=0.84000;} if(lastlow<=0.84000&&lastlow>=0.83000){LH=0.84000; LL=0.83000;} if(lastlow<=0.83000&&lastlow>=0.82000){LH=0.83000; LL=0.82000;} if(lastlow<=0.82000&&lastlow>=0.81000){LH=0.82000; LL=0.81000;} if(lastlow<=0.81000&&lastlow>=0.80000){LH=0.81000; LL=0.80000;} if(lastlow<=0.80000&&lastlow>=0.79000){LH=0.80000; LL=0.79000;} if(lastlow<=0.79000&&lastlow>=0.78000){LH=0.79000; LL=0.78000;} if(lastlow<=0.78000&&lastlow>=0.77000){LH=0.78000; LL=0.77000;} if(lastlow<=0.77000&&lastlow>=0.76000){LH=0.77000; LL=0.76000;} if(lastlow<=0.76000&&lastlow>=0.75000){LH=0.76000; LL=0.75000;} if(lastlow<=0.75000&&lastlow>=0.74000){LH=0.75000; LL=0.74000;} if(lastlow<=0.74000&&lastlow>=0.73000){LH=0.74000; LL=0.73000;} if(lastlow<=0.73000&&lastlow>=0.72000){LH=0.73000; LL=0.72000;} if(lastlow<=0.72000&&lastlow>=0.71000){LH=0.72000; LL=0.71000;} if(lastlow<=0.71000&&lastlow>=0.70000){LH=0.71000; LL=0.70000;} if(lastlow<=0.70000&&lastlow>=0.69000){LH=0.70000; LL=0.69000;} if(lastlow<=0.69000&&lastlow>=0.68000){LH=0.69000; LL=0.68000;} if(lastlow<=0.68000&&lastlow>=0.67000){LH=0.68000; LL=0.67000;} if(lastlow<=0.67000&&lastlow>=0.66000){LH=0.67000; LL=0.66000;} if(lastlow<=0.66000&&lastlow>=0.65000){LH=0.66000; LL=0.65000;} if(lastlow<=0.65000&&lastlow>=0.64000){LH=0.65000; LL=0.64000;} if(lastlow<=0.64000&&lastlow>=0.63000){LH=0.64000; LL=0.63000;} if(lastlow<=0.63000&&lastlow>=0.62000){LH=0.63000; LL=0.62000;} if(lastlow<=0.62000&&lastlow>=0.61000){LH=0.62000; LL=0.61000;} if(lastlow<=0.61000&&lastlow>=0.60000){LH=0.61000; LL=0.60000;} if(lastlow<=0.60000&&lastlow>=0.59000){LH=0.60000; LL=0.59000;} if(lastlow<=0.59000&&lastlow>=0.58000){LH=0.59000; LL=0.58000;} if(lastlow<=0.58000&&lastlow>=0.57000){LH=0.58000; LL=0.57000;} if(lastlow<=0.57000&&lastlow>=0.56000){LH=0.57000; LL=0.56000;} if(lastlow<=0.56000&&lastlow>=0.55000){LH=0.56000; LL=0.55000;} if(lastlow<=0.55000&&lastlow>=0.54000){LH=0.55000; LL=0.54000;} if(lastlow<=0.54000&&lastlow>=0.53000){LH=0.54000; LL=0.53000;} if(lastlow<=0.53000&&lastlow>=0.52000){LH=0.53000; LL=0.52000;} if(lastlow<=0.52000&&lastlow>=0.51000){LH=0.52000; LL=0.51000;} if(lastlow<=0.51000&&lastlow>=0.50000){LH=0.51000; LL=0.50000;} if(lastlow<=0.50000&&lastlow>=0.49000){LH=0.50000; LL=0.49000;} if(lastlow<=0.49000&&lastlow>=0.48000){LH=0.49000; LL=0.48000;} if(lastlow<=0.48000&&lastlow>=0.47000){LH=0.48000; LL=0.47000;} if(lastlow<=0.47000&&lastlow>=0.46000){LH=0.47000; LL=0.46000;} if(lastlow<=0.46000&&lastlow>=0.45000){LH=0.46000; LL=0.45000;} if(lastlow<=0.45000&&lastlow>=0.44000){LH=0.45000; LL=0.44000;} if(lastlow<=0.44000&&lastlow>=0.43000){LH=0.44000; LL=0.43000;} if(lastlow<=0.43000&&lastlow>=0.42000){LH=0.43000; LL=0.42000;} if(lastlow<=0.42000&&lastlow>=0.41000){LH=0.42000; LL=0.41000;} if(lastlow<=0.41000&&lastlow>=0.40000){LH=0.41000; LL=0.40000;} if(lastlow<=0.40000&&lastlow>=0.39000){LH=0.40000; LL=0.39000;} if(lastlow<=0.39000&&lastlow>=0.38000){LH=0.39000; LL=0.38000;} if(lastlow<=0.38000&&lastlow>=0.37000){LH=0.38000; LL=0.37000;} if(lastlow<=0.37000&&lastlow>=0.36000){LH=0.37000; LL=0.36000;} if(lastlow<=0.36000&&lastlow>=0.35000){LH=0.36000; LL=0.35000;} if(lastlow<=0.35000&&lastlow>=0.34000){LH=0.35000; LL=0.34000;} if(lastlow<=0.34000&&lastlow>=0.33000){LH=0.34000; LL=0.33000;} if(lastlow<=0.33000&&lastlow>=0.32000){LH=0.33000; LL=0.32000;} if(lastlow<=0.32000&&lastlow>=0.31000){LH=0.32000; LL=0.31000;} if(lastlow<=0.31000&&lastlow>=0.30000){LH=0.31000; LL=0.30000;} if(lastlow<=0.30000&&lastlow>=0.29000){LH=0.30000; LL=0.29000;} if(lastlow<=0.29000&&lastlow>=0.28000){LH=0.29000; LL=0.28000;} if(lastlow<=0.28000&&lastlow>=0.27000){LH=0.28000; LL=0.27000;} if(lastlow<=0.27000&&lastlow>=0.26000){LH=0.27000; LL=0.26000;} if(lastlow<=0.26000&&lastlow>=0.25000){LH=0.26000; LL=0.25000;} if(lastlow<=0.25000&&lastlow>=0.24000){LH=0.25000; LL=0.24000;} if(lastlow<=0.24000&&lastlow>=0.23000){LH=0.24000; LL=0.23000;} if(lastlow<=0.23000&&lastlow>=0.22000){LH=0.23000; LL=0.22000;} if(lastlow<=0.22000&&lastlow>=0.21000){LH=0.22000; LL=0.21000;} if(lastlow<=0.21000&&lastlow>=0.20000){LH=0.21000; LL=0.20000;} if(lastlow<=0.20000&&lastlow>=0.19000){LH=0.20000; LL=0.19000;} if(lastlow<=0.19000&&lastlow>=0.18000){LH=0.19000; LL=0.18000;} if(lastlow<=0.18000&&lastlow>=0.17000){LH=0.18000; LL=0.17000;} if(lastlow<=0.17000&&lastlow>=0.16000){LH=0.17000; LL=0.16000;} if(lastlow<=0.16000&&lastlow>=0.15000){LH=0.16000; LL=0.15000;} if(lastlow<=0.15000&&lastlow>=0.14000){LH=0.15000; LL=0.14000;} if(lastlow<=0.14000&&lastlow>=0.13000){LH=0.14000; LL=0.13000;} if(lastlow<=0.13000&&lastlow>=0.12000){LH=0.13000; LL=0.12000;} if(lastlow<=0.12000&&lastlow>=0.11000){LH=0.12000; LL=0.11000;} if(lastlow<=0.11000&&lastlow>=0.10000){LH=0.11000; LL=0.10000;} ///////////////////////////////////////////////////////////////////// SET_RectangleSUP("OBJSUPAREA", Time[lastlowpos], LL,Time[0] + Period()*60*0, LH, Maroon); return(0); } //================================================================================================= void SetLowZZ(int pShift, double pValue) { ZigzagBuffer[pShift]=pValue; BufChanelLow[pShift]=pValue; } //================================================================================================= void SetHighZZ(int pShift, double pValue) { ZigzagBuffer[pShift]=pValue; BufChanelHigh[pShift]=pValue; } //+------------------------------------------------------------------+ //| SET_Rectangle | //+------------------------------------------------------------------+ void SET_RectangleRES(string name, datetime Tm1, double Prc1, datetime Tm2, double Prc2, color clr){ if(ObjectFind(LabelName+name) == -1){ ObjectCreate(LabelName+name, OBJ_RECTANGLE,0, Tm1, Prc1, Tm2, Prc2); ObjectSet(LabelName+name, OBJPROP_COLOR, clr); ObjectSet(LabelName+name, OBJPROP_BACK, true); } ObjectSet(LabelName+name, OBJPROP_TIME2, Tm2); ObjectSet(LabelName+name, OBJPROP_PRICE2, Prc2); } //+------------------------------------------------------------------+ //| SET_Rectangle | //+------------------------------------------------------------------+ void SET_RectangleSUP(string name, datetime Tm1, double Prc1, datetime Tm2, double Prc2, color clr){ if(ObjectFind(LabelName+name) == -1){ ObjectCreate(LabelName+name, OBJ_RECTANGLE,0, Tm1, Prc1, Tm2, Prc2); ObjectSet(LabelName+name, OBJPROP_COLOR, clr); ObjectSet(LabelName+name, OBJPROP_BACK, true); } ObjectSet(LabelName+name, OBJPROP_TIME2, Tm2); ObjectSet(LabelName+name, OBJPROP_PRICE2, Prc2); }
ZigZag_Larsen_out & alerts.mq4
ZigZag_Larsen_out & alerts.mq4 FOREX MetaTrader4 Indicators Download
ZigZag_Larsen_out & alerts.mq4 download link will appear after 10 seconds.
ZigZag_Larsen_out & alerts.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 CLR_NONE #property indicator_color2 Red #property indicator_width2 2 #property indicator_color3 Lime #property indicator_width3 2 extern int NoiseLevel = 30; extern int SwitchPercent = 30; extern int Mode = 0; extern int OncePerCandle = 1; extern bool alertsOn = true; extern bool alertsOnCurrent = false; extern bool alertsMessage = true; extern bool alertsSound = true; extern bool alertsEmail = false; int MaxBars = 600; extern int ArrowOffset = 15; double Porog1[]; double Porog2[]; double Porog3[]; bool mds = FALSE; double LevRT; double mdt; double Const1 = 0.0; double Const2 = 0.0; double Const3 = 0.0; double Const4 = 0.0; double Const5 = 0.0; int rf1 = 0; int rf2 = 0; int rf3 = 0; int mda = 0; int mdk = -1; int mdl = 0; int mdn = 0; int mdrs = 0; int new_candle() { if (mdn != Time[0] || mdl != Bars) { mdn = Time[0]; mdl = Bars; return (1); } return (0); } int init() { IndicatorBuffers(3); SetIndexStyle(0, DRAW_SECTION, STYLE_SOLID, 2); SetIndexBuffer(0, Porog1); SetIndexBuffer(1, Porog2); SetIndexBuffer(2, Porog3); SetIndexStyle(1, DRAW_ARROW); SetIndexArrow(1, SYMBOL_ARROWDOWN); SetIndexStyle(2, DRAW_ARROW); SetIndexArrow(2, SYMBOL_ARROWUP); SetIndexEmptyValue(0, 0.0); IndicatorShortName("ZigZag_Larsen_out"); mdrs = 0; if (Mode == 0) { Const1 = Close[0] - NoiseLevel / 2 * Point; Const2 = Close[0] + NoiseLevel / 2 * Point; } else { Const1 = Open[0] - NoiseLevel / 2 * Point; Const2 = Open[0] + NoiseLevel / 2 * Point; } Const5 = Open[0]; Const2 = Const1; Const3 = Const1; Const4 = Const1; LevRT = Const1; mdt = LevRT; return (0); } int start() { int barsdown = IndicatorCounted(); if (!new_candle()) if (OncePerCandle == 1) return (0); int bars1 = Bars; if (bars1 > MaxBars) bars1 = MaxBars; int bars2 = bars1; mdk = bars2; mda = 0; Porog1[1] = Const5; int brshift = bars2 - 1; if (Mode == 0) Porog1[brshift] = Close[brshift]; else Porog1[brshift] = Open[brshift]; while (brshift >= 0) { GetMoving(brshift); if (rf3 == TRUE) { if (rf1 == 1) { Porog1[brshift] = Const3; Porog3[brshift] = Const3 - ArrowOffset * Point; Porog2[brshift] = 0.0; if (brshift == 0) Const5 = Const3; } if (rf1 == -1) { Porog1[brshift] = Const4; Porog2[brshift] = Const4 + ArrowOffset * Point; Porog3[brshift] = 0.0; if (brshift == 0) Const5 = Const4; } rf3 = FALSE; } else { if (brshift == 0) { if (rf1 == 1) Porog1[0] = Const2; if (rf1 == -1) Porog1[0] = Const1; } else { Porog1[brshift] = 0.0; Porog2[brshift] = 0.0; Porog3[brshift] = 0.0; if (brshift == 0) Const5 = 0.0; } } brshift--; } manageAlerts(); return (0); } int GetMoving(int smet) { int shifting = (Const2 - Const1) * SwitchPercent / 100.0; if (shifting < NoiseLevel) shifting = NoiseLevel; if (Mode == 1) LevRT = Open[smet]; else { if (rf1 != -1) LevRT = High[smet]; else LevRT = Low[smet]; } if (rf1 != -1 && LevRT > Const2) Const2 = LevRT; if (rf1 != 1 && LevRT < Const1) Const1 = LevRT; if (Const2 - Const1 >= NoiseLevel * Point) { if (rf1 != 1 && LevRT - Const1 >= shifting * Point) { rf1 = 1; Const3 = Const1; Const2 = LevRT; mdt = LevRT; } if (rf1 != -1 && Const2 - LevRT >= shifting * Point) { rf1 = -1; Const4 = Const2; Const1 = LevRT; mdt = LevRT; } } if (rf2 != rf1) { rf2 = rf1; rf3 = TRUE; } return (rf1); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // void manageAlerts() { if (alertsOn) { if (alertsOnCurrent) int forBar = 0; else forBar = 1; if (Porog2[forBar]!=0 || Porog3[forBar]!=0) { if (Porog2[forBar]!= 0) doAlert(0,"down"); if (Porog3[forBar]!= 0) doAlert(0,"up"); } } } void doAlert(int forBar, string doWhat) { static string previousAlert="nothing"; static datetime previousTime; string message; if (previousAlert != doWhat || previousTime != Time[forBar]) { previousAlert = doWhat; previousTime = Time[forBar]; // // // // // message = Symbol()+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" ZZLarsen signal "+doWhat; if (alertsMessage) Alert(message); if (alertsEmail) SendMail(StringConcatenate(Symbol()," ZZLarsen"),message); if (alertsSound) PlaySound("alert2.wav"); } }
Zig Zag Arrow.mq4
Zig Zag Arrow.mq4 FOREX MetaTrader4 Indicators Download
Zig Zag Arrow.mq4 download link will appear after 10 seconds.
Zig Zag Arrow.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_width1 1 #property indicator_color2 Red #property indicator_width2 1 //---- indicator parameters extern int ExtDepth=12; extern int ExtDeviation=5; extern int ExtBackstep=3; //---- indicator buffers double ExtMapBuffer[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(2); //---- drawing settings SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0, 233); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1, 234); //---- indicator buffers mapping SetIndexBuffer(0,ExtMapBuffer); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(0,0.0); //---- indicator short name IndicatorShortName("ZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int shift, back,lasthighpos,lastlowpos; double val,res; double curlow,curhigh,lasthigh,lastlow; for(shift=Bars-ExtDepth; shift>=0; shift--) { val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)]; if(val==lastlow) val=0.0; else { lastlow=val; if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=ExtMapBuffer[shift+back]; if((res!=0)&&(res>val)) ExtMapBuffer[shift+back]=0.0; } } } ExtMapBuffer[shift]=val; //--- high val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)]; if(val==lasthigh) val=0.0; else { lasthigh=val; if((val-High[shift])>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=ExtMapBuffer2[shift+back]; if((res!=0)&&(res=0; shift--) { curlow=ExtMapBuffer[shift]; curhigh=ExtMapBuffer2[shift]; if((curlow==0)&&(curhigh==0)) continue; //--- if(curhigh!=0) { if(lasthigh>0) { if(lasthigh 0) { if(lastlow>curlow) ExtMapBuffer[lastlowpos]=0; else ExtMapBuffer[shift]=0; } //--- if((curlow =0; shift--) { if(shift>=Bars-ExtDepth) ExtMapBuffer[shift]=0.0; else { res=ExtMapBuffer2[shift]; if(res!=0.0) ExtMapBuffer2[shift]=res; } } } //end//
Zeus.mq4
Zeus.mq4 FOREX MetaTrader4 Indicators Download
Zeus.mq4 download link will appear after 10 seconds.
Zeus.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_width1 2 #property indicator_color2 Lime #property indicator_width2 2 extern int SignalGap = 4; //indicator buffers int dist=24; double b1[]; double b2[]; bool test= false; bool test2 = false; int init() { SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1); SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1); SetIndexArrow(1,233); SetIndexArrow(0,234); SetIndexBuffer(0,b1); SetIndexBuffer(1,b2); //---- name for DataWindow SetIndexLabel(0,"Zeus Says Down"); SetIndexLabel(1,"Zeus Says Up"); //---- initialization done return(0); } int start() { int counted_bars=IndicatorCounted(); int nCountedBars=IndicatorCounted(); int i,limit,hhb,llb,l; if(nCountedBars<0 || Bars<5) return(-1); l=Bars-nCountedBars-1; if (counted_bars<0) return(-1); if (counted_bars>0) counted_bars--; limit=Bars-1; if(counted_bars>=1) limit=Bars-counted_bars-1; if (limit<0) limit=0; //Print ("Limit =", limit); while(l>=0) { if(High[l+3]>High[l+4] && High[l+3]>High[l+5] && High[l+3]>High[l+2] && High[l+3]>High[l+1]) { test = true; } if(Low[l+3]=0;i--) { hhb = iHighest(NULL,0,MODE_HIGH,dist,i-dist/2); llb = iLowest(NULL,0,MODE_LOW,dist,i-dist/2); if (i==hhb && test == true) //sell arrow b1[i]=High[hhb]+SignalGap*Point; if (i==llb && test2 == true) //buy arrow b2[i]=Low[llb]-SignalGap*Point; } //---- return(0); }
ZeroLag Tema MACD – mtf + lines 2 (1).mq4
ZeroLag Tema MACD – mtf + lines 2 (1).mq4 Download FOREX MetaTrader4 Indicators
ZeroLag Tema MACD – mtf + lines 2 (1).mq4 download link will appear after 10 seconds.
ZeroLag Tema MACD – mtf + lines 2 (1).mq4 Programming source code.
#property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 LimeGreen #property indicator_color2 DarkOrange #property indicator_color3 DarkOrange #property indicator_color4 Yellow #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_style4 STYLE_DOT #property indicator_level1 0 // // // // // enum enPrices { pr_close, // Close pr_open, // Open pr_high, // High pr_low, // Low pr_median, // Median pr_typical, // Typical pr_weighted, // Weighted pr_ha // Heiken-ashi }; #define PRICE_HA 7 extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; extern int FastPeriod = 24; extern int SlowPeriod = 52; extern int SignalPeriod = 9; extern enPrices Price = PRICE_HA; extern int PricePreSmooth = 1; extern bool ColorOnSignalCross = true; extern bool LinesVisible = false; extern string LinesID = "ZL TEMA macd"; extern color LinesUpColor = LimeGreen; extern color LinesDnColor = OrangeRed; extern ENUM_LINE_STYLE LinesStyle = STYLE_SOLID; extern int LinesWidth = 0; double macd[]; double macdda[]; double macddb[]; double signal[]; double mcolor[]; string shortName; string indicatorFileName; bool returnBars; //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // int init() { IndicatorBuffers(5); SetIndexBuffer(0,macd); SetIndexBuffer(1,macdda); SetIndexBuffer(2,macddb); SetIndexBuffer(3,signal); SetIndexBuffer(4,mcolor); SetIndexStyle (0,DRAW_LINE); SetIndexStyle (1,DRAW_LINE); SetIndexStyle (2,DRAW_LINE); SetIndexStyle (3,DRAW_LINE); shortName = LinesID+" ("+FastPeriod+","+SlowPeriod+","+SignalPeriod+")"; indicatorFileName = WindowExpertName(); returnBars = TimeFrame == -99; TimeFrame = MathMax(TimeFrame,_Period); IndicatorShortName(shortName); return(0); } int deinit() { string find = LinesID+":"; for (int i=ObjectsTotal()-1; i>= 0; i--) { string name = ObjectName(i); if (StringFind(name,find)==0) ObjectDelete(name); } return(0); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); if (returnBars) { macd[0] = limit+1; return(0); } int window = WindowFind(shortName); // // // // // if (TimeFrame == Period()) { double alpha = 2.0/(SignalPeriod+1); if (mcolor[limit]==-1) CleanPoint(limit,macdda,macddb); for (int i=limit; i>=0; i--) { double tema1 = ihTema(i,FastPeriod,Price,PricePreSmooth,0); double fast = tema1+(tema1-iTema(tema1,FastPeriod,i,0)); double tema2 = ihTema(i,SlowPeriod,Price,PricePreSmooth,1); double slow = tema2+(tema2-iTema(tema2,SlowPeriod,i,1)); macd[i] = fast-slow; signal[i] = signal[i+1]+alpha*(macd[i]-signal[i+1]); macdda[i] = EMPTY_VALUE; macddb[i] = EMPTY_VALUE; mcolor[i] = mcolor[i+1]; if (ColorOnSignalCross) { if (macd[i]>signal[i]) mcolor[i] = 1; if (macd[i]macd[i+1]) mcolor[i] = 1; if (macd[i] -1) { string name = LinesID+":"+Time[i]; ObjectDelete(name); if (mcolor[i]!=mcolor[i+1]) { color theColor = LinesUpColor; if (mcolor[i]==-1) theColor = LinesDnColor; ObjectCreate(name,OBJ_VLINE,window,Time[i],0); ObjectSet(name,OBJPROP_WIDTH,LinesWidth); ObjectSet(name,OBJPROP_STYLE,LinesStyle); ObjectSet(name,OBJPROP_COLOR,theColor); } } } return(0); } // // // // // limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,TimeFrame,indicatorFileName,-99,0,0)*TimeFrame/Period())); if (mcolor[limit]==-1) CleanPoint(limit,macdda,macddb); for (i=limit; i>=0; i--) { int y = iBarShift(NULL,TimeFrame,Time[i]); macd[i] = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,FastPeriod,SlowPeriod,SignalPeriod,Price,PricePreSmooth,ColorOnSignalCross,LinesVisible,LinesID,LinesUpColor,LinesDnColor,LinesStyle,LinesWidth,0,y); signal[i] = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,FastPeriod,SlowPeriod,SignalPeriod,Price,PricePreSmooth,ColorOnSignalCross,LinesVisible,LinesID,LinesUpColor,LinesDnColor,LinesStyle,LinesWidth,3,y); mcolor[i] = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,FastPeriod,SlowPeriod,SignalPeriod,Price,PricePreSmooth,ColorOnSignalCross,LinesVisible,LinesID,LinesUpColor,LinesDnColor,LinesStyle,LinesWidth,4,y); macdda[i] = EMPTY_VALUE; macddb[i] = EMPTY_VALUE; if (mcolor[i]==-1) PlotPoint(i,macdda,macddb,macd); } return(0); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // double workhTema[][16]; double ihTema(int i, int period, int usePrice, int preSmooth, int index=0) { if (ArrayRange(workhTema,0)!=Bars) ArrayResize(workhTema,Bars); index *= 8; int r = Bars-i-1; // // // // // if (usePrice==pr_ha) { double haOpen = (workhTema[r-1][index+6] + workhTema[r-1][index+7]) / 2; double haClose = (Open[i]+High[i]+Low[i]+Close[i])/4.0; double haHigh = MathMax(High[i], MathMax(haOpen,haClose)); double haLow = MathMin(Low[i] , MathMin(haOpen,haClose)); if(haOpen =0; k++) price += (workhTema[r-k][index+4]+workhTema[r-k][index+5]+workhTema[r-k][index+6]+workhTema[r-k][index+7])/4.0; price /= preSmooth; } else price = iMA(NULL,0,preSmooth,0,MODE_SMA,(int)usePrice,i); // // // // // double alpha = 2.0 / (1.0 + period); workhTema[r][index+3] = workhTema[r-1][index+3]+alpha*(price -workhTema[r-1][index+3]); workhTema[r][index+2] = workhTema[r-1][index+2]+alpha*(workhTema[r][index+3]-workhTema[r-1][index+2]); workhTema[r][index+1] = workhTema[r-1][index+1]+alpha*(workhTema[r][index+2]-workhTema[r-1][index+1]); workhTema[r][index+0] = 3*workhTema[r][index+3]-3*workhTema[r][index+2]+workhTema[r][index+1]; return(workhTema[r][index+0]); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // double workTema[][6]; #define _ema1 0 #define _ema2 1 #define _ema3 2 double iTema(double price, double period, int r, int instanceNo=0) { if (ArrayRange(workTema,0)!= Bars) ArrayResize(workTema,Bars); instanceNo*=3; r = Bars-r-1; // // // // // double alpha = 2.0 / (1.0+period); workTema[r][_ema1+instanceNo] = workTema[r-1][_ema1+instanceNo]+alpha*(price -workTema[r-1][_ema1+instanceNo]); workTema[r][_ema2+instanceNo] = workTema[r-1][_ema2+instanceNo]+alpha*(workTema[r][_ema1+instanceNo]-workTema[r-1][_ema2+instanceNo]); workTema[r][_ema3+instanceNo] = workTema[r-1][_ema3+instanceNo]+alpha*(workTema[r][_ema2+instanceNo]-workTema[r-1][_ema3+instanceNo]); return(workTema[r][_ema3+instanceNo]+3.0*(workTema[r][_ema1+instanceNo]-workTema[r][_ema2+instanceNo])); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // void CleanPoint(int i,double& first[],double& second[]) { if ((second[i] != EMPTY_VALUE) && (second[i+1] != EMPTY_VALUE)) second[i+1] = EMPTY_VALUE; else if ((first[i] != EMPTY_VALUE) && (first[i+1] != EMPTY_VALUE) && (first[i+2] == EMPTY_VALUE)) first[i+1] = EMPTY_VALUE; } // // // // // void PlotPoint(int i,double& first[],double& second[],double& from[]) { if (first[i+1] == EMPTY_VALUE) { if (first[i+2] == EMPTY_VALUE) { first[i] = from[i]; first[i+1] = from[i+1]; second[i] = EMPTY_VALUE; } else { second[i] = from[i]; second[i+1] = from[i+1]; first[i] = EMPTY_VALUE; } } else { first[i] = from[i]; second[i] = EMPTY_VALUE; } }
Zero lag T3.mq4
Zero lag T3.mq4 FOREX MetaTrader4 Indicators Download
Zero lag T3.mq4 download link will appear after 10 seconds.
Zero lag T3.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 4 //#property indicator_plots 1 //#property indicator_label1 "Zero lag T3" //#property indicator_type1 DRAW_COLOR_LINE #property indicator_color2 clrLightGray #property indicator_color3 clrCrimson #property indicator_color4 clrGreen #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 //--- input parameters #includeenum enT3Type { t3_tillson, // Tim Tillson way of calculation t3_fulksmat // Fulks/Matulich way of calculation }; input double inpPeriod = 14; // Period input double inpHot = 0.7; // T3 hot input enT3Type inpT3Type = t3_fulksmat; // T3 type input ENUM_APPLIED_PRICE inpPrice = PRICE_MEDIAN; // Price extern ENUM_TIMEFRAMES RefreshPeriod = PERIOD_M1; //желательно ставить от М1 до H1 //--- indicator buffers int hWindow = 0; int oldBars = 0; double val[],valc_lime[],valc_pink[],valc_gray[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,val); SetIndexBuffer(1,valc_gray); SetIndexBuffer(2,valc_pink); SetIndexBuffer(3,valc_lime); SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); SetIndexStyle(3,DRAW_LINE); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(2,0.0); SetIndexEmptyValue(3,0.0); //--- indicator short name assignment IndicatorShortName("Zero lag T3 ("+(string)inpPeriod+")"); //--- //--- hWindow = WindowHandle(Symbol(), Period()); oldBars = iBars(NULL,RefreshPeriod); //iTime(NULL,RefreshPeriod,0); // //--- return (INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator de-initialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //**************************************************************************// if (oldBars < iBars(NULL,RefreshPeriod) && hWindow != 0) //iTime(NULL,RefreshPeriod,0) { int message=0; switch (Period()) { case 1: message = 33137; break; case 5: message = 33138; break; case 15: message = 33139; break; case 30: message = 33140; break; case 60: message = 33135; break; case 240: message = 33136; break; case 1440: message = 33134; break; case 10080: message = 33141; break; default: message = 33137; break; // m1, if we can't identify current TF } if (message!=0) { PostMessageW( hWindow, WM_COMMAND, 33135, 0 ); // switch to weekly TF PostMessageW( hWindow, WM_COMMAND, message, 0 ); // switch to original TF } else PostMessageW(hWindow,WM_COMMAND,33324,0); oldBars = iBars(NULL,RefreshPeriod); //iTime(NULL,RefreshPeriod,0) } //**************************************************************************// if(Bars(_Symbol,_Period) 0) { valc_gray[i-1]=val[i-1]; if (val[i] val[i-1]) {valc_pink[i]=val[i]; valc_gray[i]=0; valc_lime[i]=0;} else {valc_pink[i]=0; valc_lime[i]=0;} } //valc[i]=(i>0) ?(val[i]>val[i-1]) ? 2 :(val[i] 0) ? workT3[r-1][k+buffer]: price; if(r>0 && period>1) { workT3[r][0+buffer] = workT3[r-1][0+buffer]+workT3Coeffs[instanceNo][_alpha]*(price -workT3[r-1][0+buffer]); workT3[r][1+buffer] = workT3[r-1][1+buffer]+workT3Coeffs[instanceNo][_alpha]*(workT3[r][0+buffer]-workT3[r-1][1+buffer]); workT3[r][2+buffer] = workT3[r-1][2+buffer]+workT3Coeffs[instanceNo][_alpha]*(workT3[r][1+buffer]-workT3[r-1][2+buffer]); workT3[r][3+buffer] = workT3[r-1][3+buffer]+workT3Coeffs[instanceNo][_alpha]*(workT3[r][2+buffer]-workT3[r-1][3+buffer]); workT3[r][4+buffer] = workT3[r-1][4+buffer]+workT3Coeffs[instanceNo][_alpha]*(workT3[r][3+buffer]-workT3[r-1][4+buffer]); workT3[r][5+buffer] = workT3[r-1][5+buffer]+workT3Coeffs[instanceNo][_alpha]*(workT3[r][4+buffer]-workT3[r-1][5+buffer]); } return(workT3Coeffs[instanceNo][_c1]*workT3[r][5+buffer] + workT3Coeffs[instanceNo][_c2]*workT3[r][4+buffer]+ workT3Coeffs[instanceNo][_c3]*workT3[r][3+buffer]+ workT3Coeffs[instanceNo][_c4]*workT3[r][2+buffer]); } // //--- // double getPrice(ENUM_APPLIED_PRICE tprice,const double &open[],const double &close[],const double &high[],const double &low[],int i,int _bars) { if(i>=0) switch(tprice) { case PRICE_CLOSE: return(close[i]); case PRICE_OPEN: return(open[i]); case PRICE_HIGH: return(high[i]); case PRICE_LOW: return(low[i]); case PRICE_MEDIAN: return((high[i]+low[i])/2.0); case PRICE_TYPICAL: return((high[i]+low[i]+close[i])/3.0); case PRICE_WEIGHTED: return((high[i]+low[i]+close[i]+close[i])/4.0); } return(0); } //+------------------------------------------------------------------+
ZB TMA TT.mq4
ZB TMA TT.mq4 FOREX MetaTrader4 Indicators Download
ZB TMA TT.mq4 download link will appear after 10 seconds.
ZB TMA TT.mq4 Programming source code.
#property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 White #property indicator_color2 RoyalBlue #property indicator_color3 Lavender //Lime #property indicator_color4 Purple #property indicator_color5 Lime #property indicator_color6 Red #property indicator_color7 Lime #property indicator_color8 Red #property indicator_width1 4 #property indicator_width2 2 #property indicator_width5 2 #property indicator_width6 2 extern int TMAPeriod = 3; extern int HalfTMAPeriod = 21; extern int TMAPrice = 0; extern bool ShowZigZag = true; extern int Depth = 12; extern int Deviation = 20; extern int Backstep = 3; double KREST[]; double ZIGZAG[]; double CenterTMA[]; double HalfTMA[]; double ArrowUP[]; double ArrowDN[]; double ZoneBUY[]; double ZoneSELL[]; int gia_136[6] = {0, 0, 0, 0, 0, 0}; int gia_140[5] = {0, 0, 0, 0, 0}; int gi_144; int gi_148; int gi_152; int gi_156; int gi_160; bool gi_164 = TRUE; int g_bars_168 = 0; void f0_6(int i) { if (Bars - i > TMAPeriod + 1) f0_5(i); else CenterTMA[i] = 0; if (Bars - i > HalfTMAPeriod + TMAPeriod + 2) { CalcTMAlines(i); return; } HalfTMA[i] = 0; } void f0_5(int i) { int li_4; int count_8; int counted_bars; int limit; double ld_20; switch (TMAPrice) { case 0: CenterTMA[i] = iMA(NULL, 0, TMAPeriod + 1, 0, MODE_LWMA, PRICE_CLOSE, i); break; case 1: CenterTMA[i] = iMA(NULL, 0, TMAPeriod + 1, 0, MODE_LWMA, PRICE_OPEN, i); break; case 4: CenterTMA[i] = iMA(NULL, 0, TMAPeriod + 1, 0, MODE_LWMA, PRICE_MEDIAN, i); break; case 5: CenterTMA[i] = iMA(NULL, 0, TMAPeriod + 1, 0, MODE_LWMA, PRICE_TYPICAL, i); break; case 6: CenterTMA[i] = iMA(NULL, 0, TMAPeriod + 1, 0, MODE_LWMA, PRICE_WEIGHTED, i); break; default: CenterTMA[i] = iMA(NULL, 0, TMAPeriod + 1, 0, MODE_LWMA, PRICE_OPEN, i); } for (int x = i + TMAPeriod + 2; x > i; x--) { ld_20 = 0.0; li_4 = 0; count_8 = 0; counted_bars = x + TMAPeriod; limit = x - TMAPeriod; if (limit < i) limit = i; while (counted_bars >= x) { count_8++; ld_20 += count_8 * f0_2(counted_bars); li_4 += count_8; counted_bars--; } while (counted_bars >= limit) { count_8--; ld_20 += count_8 * f0_2(counted_bars); li_4 += count_8; counted_bars--; } CenterTMA[x] = ld_20 / li_4; } } double f0_2(int i) { switch (TMAPrice) { case 0: return (Close[i]); case 1: return (Open[i]); case 4: return ((High[i] + Low[i]) / 2.0); case 5: return ((Close[i] + High[i] + Low[i]) / 3.0); case 6: return ((2.0 * Close[i] + High[i] + Low[i]) / 4.0); } return (Open[i]); } void CalcTMAlines(int i) { double ld_4; double ld_12; for (int k = i + TMAPeriod + 2; k >= i; k--) { ld_4 = CenterTMA[ArrayMaximum(CenterTMA, HalfTMAPeriod, k)]; ld_12 = CenterTMA[ArrayMinimum(CenterTMA, HalfTMAPeriod, k)]; HalfTMA[k] = ((Backstep + 2) * 2 * CenterTMA[k] - (ld_4 + ld_12)) / 2.0 / (Backstep + 1); } } void ManageZigZag(int i) { int li_4; int j; int counted_bars; int index_16; int k = i - 1; int li_24 = 0; int li_28 = 0; while (k < gi_144 && counted_bars == 0) { k++; ZIGZAG[k] = 0; li_4 = k - Deviation; if (li_4 < i) li_4 = i; j = k + Deviation; if (k == ArrayMinimum(HalfTMA, j - li_4 + 1, li_4)) { counted_bars = -1; li_24 = k; } if (k == ArrayMaximum(HalfTMA, j - li_4 + 1, li_4)) { counted_bars = 1; li_28 = k; } } if (counted_bars != 0) { index_16 = 0; if (k > i) { if (HalfTMA[k] > HalfTMA[i]) { if (counted_bars == 1) { if (k >= i + Deviation && index_16 < 5) { index_16++; gia_136[index_16] = k; } li_28 = k; ZIGZAG[k] = HalfTMA[k]; } } else { if (counted_bars == -1) { if (k >= i + Deviation && index_16 < 5) { index_16++; gia_136[index_16] = k; } li_24 = k; ZIGZAG[k] = HalfTMA[k]; } } } while (k < gi_160 || index_16 < 5) { ZIGZAG[k] = 0; li_4 = k - Deviation; if (li_4 < i) li_4 = i; j = k + Deviation; if (k == ArrayMinimum(HalfTMA, j - li_4 + 1, li_4)) { if (counted_bars == -1 && HalfTMA[k] < HalfTMA[li_24]) { if (k >= i + Deviation && index_16 < 5) gia_136[index_16] = k; ZIGZAG[li_24] = 0; ZIGZAG[k] = HalfTMA[k]; li_24 = k; } if (counted_bars == 1) { if (k >= i + Deviation && index_16 < 5) { index_16++; gia_136[index_16] = k; } ZIGZAG[k] = HalfTMA[k]; counted_bars = -1; li_24 = k; } } if (k == ArrayMaximum(HalfTMA, j - li_4 + 1, li_4)) { if (counted_bars == 1 && HalfTMA[k] > HalfTMA[li_28]) { if (k >= i + Deviation && index_16 < 5) gia_136[index_16] = k; ZIGZAG[li_28] = 0; ZIGZAG[k] = HalfTMA[k]; li_28 = k; } if (counted_bars == -1) { if (k >= i + Deviation && index_16 < 5) { index_16++; gia_136[index_16] = k; } ZIGZAG[k] = HalfTMA[k]; counted_bars = 1; li_28 = k; } } k++; if (k > gi_144) return; } gi_152 = Bars - gia_136[5]; ZIGZAG[i] = HalfTMA[i]; return; } } void ManageArrowsZones(int i) { int li_4; int j; int counted_bars; int index_16; int k = i - 1; int li_24 = 0; int li_28 = 0; while (k <= gi_160 && counted_bars == 0) { k++; ZoneSELL[k] = 0; ZoneBUY[k] = 0; ArrowDN[k] = 0; ArrowUP[k] = 0; KREST[k] = 0; li_4 = k - Depth; if (li_4 < i) li_4 = i; j = k + Depth; if (k == ArrayMinimum(HalfTMA, j - li_4 + 1, li_4)) { counted_bars = -1; li_24 = k; } if (k == ArrayMaximum(HalfTMA, j - li_4 + 1, li_4)) { counted_bars = 1; li_28 = k; } } if (counted_bars != 0) { index_16 = 0; if (k > i) { if (HalfTMA[k] > HalfTMA[i]) { if (counted_bars == 1) { if (k >= i + Depth && index_16 < 4) { index_16++; gia_140[index_16] = k; } li_28 = k; ArrowDN[k - 1] = Open[k - 1]; } } else { if (counted_bars == -1) { if (k >= i + Depth && index_16 < 4) { index_16++; gia_140[index_16] = k; } li_24 = k; ArrowUP[k - 1] = Open[k - 1]; } } } while (k <= gi_160 || index_16 < 4) { ZoneSELL[k] = 0; ZoneBUY[k] = 0; ArrowDN[k] = 0; ArrowUP[k] = 0; KREST[k] = 0; li_4 = k - Depth; if (li_4 < i) li_4 = i; j = k + Depth; if (k == ArrayMinimum(HalfTMA, j - li_4 + 1, li_4)) { if (counted_bars == -1 && HalfTMA[k] < HalfTMA[li_24]) { if (k >= i + Depth && index_16 < 4) gia_140[index_16] = k; ArrowUP[li_24 - 1] = 0; ArrowUP[k - 1] = Open[k - 1]; li_24 = k; } if (counted_bars == 1) { if (k >= i + Depth && index_16 < 4) { index_16++; gia_140[index_16] = k; } ArrowUP[k - 1] = Open[k - 1]; counted_bars = -1; li_24 = k; } } if (k == ArrayMaximum(HalfTMA, j - li_4 + 1, li_4)) { if (counted_bars == 1 && HalfTMA[k] > HalfTMA[li_28]) { if (k >= i + Depth && index_16 < 4) gia_140[index_16] = k; ArrowDN[li_28 - 1] = 0; ArrowDN[k - 1] = Open[k - 1]; li_28 = k; } if (counted_bars == -1) { if (k >= i + Depth && index_16 < 4) { index_16++; gia_140[index_16] = k; } ArrowDN[k - 1] = Open[k - 1]; counted_bars = 1; li_28 = k; } } k++; if (k > gi_160) return; } gi_148 = Bars - gia_140[4]; return; } } void DrawKREST() { int li_0; int li_4 = 0; for (int j = gi_160; ZIGZAG[j] == 0.0; j--) { } int counted_bars = j; double ld_16 = ZIGZAG[j]; for (j--; ZIGZAG[j] == 0.0; j--) { } if (ZIGZAG[j] > ld_16) li_4 = 1; if (ZIGZAG[j] > 0.0 && ZIGZAG[j] < ld_16) li_4 = -1; ld_16 = ZIGZAG[counted_bars]; for (j = counted_bars - 1; j > 0; j--) { if (ZIGZAG[j] > ld_16) { li_4 = -1; ld_16 = ZIGZAG[j]; } if (ZIGZAG[j] > 0.0 && ZIGZAG[j] < ld_16) { li_4 = 1; ld_16 = ZIGZAG[j]; } if (li_4 > 0 && ArrowDN[j] > 0.0) { KREST[j] = Open[j]; ArrowDN[j] = 0; } if (li_4 < 0 && ArrowUP[j] > 0.0) { KREST[j] = Open[j]; ArrowUP[j] = 0; } if (li_4 > 0 && ArrowUP[j] > 0.0) { if (j > 1) { counted_bars = j - 1; li_0 = counted_bars - Depth + 1; if (li_0 < 0) li_0 = 0; for (int li_24 = counted_bars; li_24 >= li_0 && ArrowDN[li_24] == 0.0; li_24--) { ZoneBUY[li_24] = ArrowUP[j]; ZoneSELL[li_24] = 0; } } if (j == 1) ZoneBUY[0] = ArrowUP[j]; } if (li_4 < 0 && ArrowDN[j] > 0.0) { if (j > 1) { counted_bars = j - 1; li_0 = counted_bars - Depth + 1; if (li_0 < 0) li_0 = 0; for (li_24 = counted_bars; li_24 >= li_0 && ArrowUP[li_24] == 0.0; li_24--) { ZoneSELL[li_24] = ArrowDN[j]; ZoneBUY[li_24] = 0; } } if (j == 1) ZoneSELL[0] = ArrowDN[j]; } } } void deinit() { } int init() { //string lsa_unused_0[256]; IndicatorBuffers(8); SetIndexBuffer(0, KREST); SetIndexStyle(0, DRAW_ARROW); SetIndexArrow(0, SYMBOL_STOPSIGN); SetIndexEmptyValue(0, 0.0); SetIndexBuffer(1, ZIGZAG); if (ShowZigZag) { SetIndexStyle(1, DRAW_SECTION); SetIndexEmptyValue(1, 0.0); } else SetIndexStyle(1, DRAW_NONE); SetIndexBuffer(2, CenterTMA); SetIndexStyle(2, DRAW_LINE); SetIndexBuffer(3, HalfTMA); SetIndexStyle(3, DRAW_LINE); SetIndexBuffer(4, ArrowUP); SetIndexStyle(4, DRAW_ARROW); SetIndexArrow(4, 233); SetIndexEmptyValue(4, 0.0); SetIndexBuffer(5, ArrowDN); SetIndexStyle(5, DRAW_ARROW); SetIndexArrow(5, 234); SetIndexEmptyValue(5, 0.0); SetIndexBuffer(6, ZoneBUY); SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID); SetIndexArrow(6, 116); SetIndexEmptyValue(6, 0.0); SetIndexBuffer(7, ZoneSELL); SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID); SetIndexArrow(7, 116); SetIndexEmptyValue(7, 0.0); return (0); } int start() { ////string ls_0 = "2333.01.30"; ////int str2time_8 = StrToTime(ls_0); ////if (TimeCurrent() >= str2time_8) { //// Alert("Maaf simple-v3 Sudah Expired...! Sumarjan Toguna diFB"); //// return (0); ////} int counted_bars = IndicatorCounted(); if (counted_bars < 0) return (-1); if (counted_bars > 0) counted_bars--; if (gi_164 == TRUE) { if (TMAPeriod < 2) TMAPeriod = 2; if (Bars <= (Deviation + HalfTMAPeriod + TMAPeriod + 2) * 2) return (-1); if (Depth <= TMAPeriod) Depth = TMAPeriod + 1; gi_144 = Bars - (Deviation + HalfTMAPeriod + TMAPeriod + 2); gi_160 = gi_144; gi_156 = gi_160; g_bars_168 = Bars; gi_164 = FALSE; } int limit = Bars - counted_bars; for (int k = limit; k >= 0; k--) f0_6(k); if (g_bars_168 != Bars) { gi_156 = Bars - gi_148; gi_160 = Bars - gi_152; g_bars_168 = Bars; } ManageArrowsZones(0); ManageZigZag(0); DrawKREST(); return (0); }