indicateur fibonacci temporel
Forums › ProRealTime forum Français › Support ProBuilder › indicateur fibonacci temporel
- This topic has 1 reply, 2 voices, and was last updated 6 months ago by JC_Bywan.
-
-
04/27/2024 at 5:38 PM #231991
Bonjour à tous,
Cet indicateur, calculé par rapport au nombre d’or, est un indicateur qui va calculer et définir les
impulsions des prix des marchés financiers. Il détermine les moments, où en même temps, un
pourcentage majoritaire d’investisseurs va prendre position à l’achat ou la vente sur tel ou tel titre.Basées sur les nombres de Fibonacci (le nombre d’or), les impulsions sont calculées par rapport
aux derniers retracements des prix d’un marché et annoncera avec souvent une précision
déconcertante les futures impulsions des prix en temps et en heure.Le trader avec Fibonacci Temporel sera à même à savoir quand il pourra investir et quand il
s’attendra à prendre ses bénéfices.Il suffit de lire les lignes 0.618 ou 1.618 ou 2.618 sur QTA-v3 et tracer un ligne pour connaître les futures
impulsions.L’indicateur Fibonacci Temporel est capable :
– d’indiquer les retracements
– d’indiquer les pull-back
– d’indiquer les accélérations du marché (lors d’un retournement, consolidation)
– d’indiquer le sens de la tendance avec sa courbe violette
– d’indiquer au trader à quelle heure prendre position et ses bénéficesJ’aurais donc besoin des compétences d’un membre du forum pour convertir cet indicateur MT4 très intéressant.
En voici le code:
//|———————————————————————-|//| Quik Time Analizir |//|———————————————————————-|//| |//| “Parameters for ZigZag” |//| |//|———————————————————————-|//|ExtIndicator – âûáîð âàðèàíòà èíäèêàòîðà, íà îñíîâå êîòîðîãî |//| ñòðîÿòñÿ ïàòòåðíû Ïåñàâåíòî |//| 0 – Zigzag èç ìåòàòðåéäåðà, ñòàíäàðòíûé |//| 1 – Zigzag Àëåêñà, |//| 2 – èíäèêàòîð ïîäîáíûé âñòðîåííîìó â Ensign |//| 3 – ZigZag Ensign ñ ïåðåìåííûì çíà÷åíèåì minBars |//| 4 – ZigZag, ðàçðàáîòàë tauber |//| 5 – âàðèàöèÿ íà òåìó ñâèíãîâ Ãàííà |//| 6 – DT-ZigZag ñ âíåøíèì ZigZag_new_nen3.mq4 |//| 7 – DT-ZigZag ñ âíåøíèì DT_ZZ.mq4 (ðàçðàáîòàë klot) |//| 8 – DT-ZigZag ñ âíåøíèì CZigZag.mq4 (ðàçðàáîòàë Candid) |//| 10 – DT-ZigZag ñ âíåøíèì Swing_zz – ýòî ExtIndicator=5 |//| â ðåæèìå DT |//| 12 – ZigZag, ðàçðàáîòàë Talex |//| 13 – SQZZ çèãçàã, ðàçðàáîòàë Òîâàðîâåä |//| |//|minBars – ôèëüòð áàðîâûé (çàäàåòñÿ êîëè÷åñòâî áàðîâ) |//|minSize – ôèëüòð ïî êîëè÷åñòâó ïóíêòîâ (çàäàåòñÿ êîëè÷åñòâî ïóíêòîâ) |//| |//|ExtDeviation è ExtBackstep – ïàðàìåòðû îñòàâøèåñÿ îò ZigZag èç MT4 |//| |//|GrossPeriod – çíà÷åíèå òàéìôðåéìà, âûðàæåííîå â ìèíóòàõ (÷èñëî ìèíóò),|//| äàííûå ñ êîòîðîãî áåðóòñÿ äëÿ ïîñòðîåíèÿ ZigZag â ðåæèìå DT-ZigZag |//| |//|minPercent – ïðîöåíòíûé ôèëüòð (çàäàåòñÿ ïðîöåíò, íàïðèìåð 0.5) |//| Åñëè èñïîëüçóþòñÿ ïðîöåíòû – ñòàâèòå ÷èñëî, à minSize=0; |//| |//|ExtPoint=11 – êîëè÷åñòâî òî÷åê çèãçàãà äëÿ çèãçàãà Talex |//| |//|ExtStyleZZ – = true – çàäàåò ñòèëü ëèíèé ZigZag ÷åðåç âêëàäêó ÖÂÅÒÀ |//| = false – Zigzag âûâîäèòñÿ òî÷êàìè ó ýêñòðåìóìîâ |//| |//|ExtNumberPeak – âêëþ÷àåò íóìåðàöèþ ïåðåëîìîâ ZigZag íà÷èíàÿ ñ 1 |//|ExtNumberPeak10 – ðàçðåøàåò âûâîä íîìåðîâ òîëüêî ó ïåðâûõ 10 ïåðåëîìîâ|//|ExtNumberPeakLow – âûâîä ÷èñåë òîëüêî ó Low èëè ó High è Low |//|ExtNumberPeakColor – öâåò ÷èñåë |//|ExtNumberPeakFontSize – ðàçìåð ÷èñåë |//|———————————————————————-|//| |//| “Parameters for Fibo Time” |//| |//|———————————————————————-|//|ExtFiboTimeNum – çàäàåò ïåðåëîìû çèãçàãà, îò êîòîðûõ ñòðîÿòñÿ |//| ExtFiboTime, íå ïðèâÿçàííûå ê âèëàì Ýíäðþñà |//| |//|ExtFiboTimeHH- âêëþ÷àåò âðåìåííûå çîíû ôèáî High-High |//| |//|ExtFiboTimeLH- âêëþ÷àåò âðåìåííûå çîíû ôèáî Low-High |//| |//|ExtFiboTimeLL- âêëþ÷àåò âðåìåííûå çîíû ôèáî Low-Low |//| |//|ExtFiboTimeHL- âêëþ÷àåò âðåìåííûå çîíû ôèáî High-Low |//| |//|ExtFiboTimeHHC- çàäàåò öâåò ëèíèé âðåìåííîé çîíû High-High |//| |//|ExtFiboTimeLHC- çàäàåò öâåò ëèíèé âðåìåííîé çîíû Low-High |//| |//|ExtFiboTimeLLC- çàäàåò öâåò ëèíèé âðåìåííîé çîíû Low-Low |//| |//|ExtFiboTimeHLC- çàäàåò öâåò ëèíèé âðåìåííîé çîíû High-Low |//| |//|ExtVisibleDateTime- âêëþ÷àåò ïîêàç çíà÷åíèé äàòû è âðåìåíè âðåìåííûõ |//| çîí |//| |//|ExtVisibleNumberFiboTime- ïîçâîëÿåò âûäåëèòü òå Fibo Time, ó êîòîðûõ |//| íåîáõîäèìî ïîêàçàòü çíà÷åíèå äàòû è âðåìåíè |//| |//| 1 – âûâîäèòñÿ çíà÷åíèå äàòû è âðåìåíè |//| 0 – íå âûâîäèòñÿ |//| |//| ïåðâàÿ öèôðà – äëÿ Fibo Time High-High |//| âòîðàÿ öèôðà – äëÿ Fibo Time Low-High |//| òðåòüÿ öèôðà – äëÿ Fibo Time Low-Low |//| ÷åòâåðòàÿ öèôðà – äëÿ Fibo Time High-Low |//| |//|ExtFiboFreeHH, ExtFiboFreeLH, ExtFiboFreeLL, ExtFiboFreeHL – çàäàþò |//| çíà÷åíèÿ ïîëüçîâàòåëüñêèõ Fibo Time |//|ExtFiboType = 0 – ñòàíäàðòíûå ôèáû |//| 1 – ôèáû ñ ÷èñëàìè Ïåñàâåíòî è ò.ä. |//| 2 – ôèáû, çàäàííûå ïîëüçîâàòåëåì |//|———————————————————————-|//| |//| “Common Parameters” |//| |//|———————————————————————-|//|ExtObjectColor – çàäàåò öâåò ëèíèè, ñîåäèíÿþùåé áàçîâûå òî÷êè îáúåêòîâ|//| |//|ExtObjectStyle – çàäàåò còèëü ëèíèè, |//| ñîåäèíÿþùåé áàçîâûå òî÷êè îáúåêòîâ|//| |//|ExtObjectWidth – çàäàåò òîëùèíó ëèíèè, |//| ñîåäèíÿþùåé áàçîâûå òî÷êè îáúåêòîâ|//| |//|ExtDinamic – ðàçðåøàåò âûâîä ñòàòè÷åñêèõ èíñòðóìåíòîâ êàê äèíàìè÷åñêèõ|//| ïðè ýòîì ïðè ïîÿâëåíèè íîâîãî ëó÷à ñòàòè÷åñêèå |//| èíñòðóìåíòû ïåðåìåùàþòñÿ íà äðóãèå ïåðåëîìû çèãçàãà |//| |//|ZigZagHighLow – çàäàåò, îò êàêèõ òî÷åê äåëàòü ïîñòðîåíèå |//| ïàòòåðíîâ Ïåñàâåíòî, âèë Ýíäðþñà è ò.ä. |//|true – îò ýêñòðåìóìîâ áàðîâ |//|false – îò ïåðåëîìîâ ZigZag, êîãäà îíè âèñÿò â “âîçäóõå” |//| |//|ExtBack – çàäàåò âûâîä âñåõ îáúåêòîâ â âèäå ôîíà |//| |//|ExtSave – ðàçðåøàåò ñîõðàíåíèå êîìïëåêòà ñòàòè÷åñêèõ âèë è |//| Fibo Time |//| |//|ExtComplekt – çàäàåò íîìåð èíäèêàòîðà. Ïðè âûâîäå íà ãðàôèê íåñêîëüêèõ|//| èíäèêàòîðîâ ÷åðåç ýòîò ïàðàìåòð çàäàåòñÿ íîìåð êîïèè. |//| Ïðè ýòîì âñå êîïèè èíäèêàòîðà áóäóò ðàáîòàòü êîððåêòíî. |//+———————————————————————-+#property copyright “nen”#property link “http://”// îïèñàíèå http://#property stacksize 65535#property indicator_separate_window#property indicator_buffers 6#property indicator_color1 Magenta //Red//#property indicator_width6 5#property indicator_color2 Green#property indicator_color3 Orange#property indicator_color4 LightSkyBlue#property indicator_color5 LemonChiffon//#property indicator_color4 Chartreuse//#property indicator_color5 Red#property indicator_color6 Magenta //Yellow#define pi 3.14159265#define phi 1.61803399//===================================//—- indicator parametersextern string ______________0_____________ = “Parameters for ZigZag”;extern int ExtIndicator = 0;extern int minBars = 12;extern int minSize = 50;// Ïåðåìåííûå îò ZigZag èç ÌÒextern int ExtDeviation = 8;extern int ExtBackstep = 3;// Ïåðåìåííàÿ äëÿ nen-ZigZagextern int GrossPeriod = 1440;//—-extern double minPercent = 0;extern int ExtPoint=11; // êîëè÷åñòâî òî÷åê çèãçàãà äëÿ çèãçàãà Talexextern bool ExtStyleZZ = true;// âûâîä íîìåðîâ ïåðåëîìîâ çèãçàãîâextern bool ExtNumberPeak = false;extern bool ExtNumberPeak10 = true;extern bool ExtNumberPeakLow = true;extern color ExtNumberPeakColor = Red;extern int ExtNumberPeakFontSize = 11;extern string ______________1_____________ = “Parameters Fibo Time”;// Âðåìåííûå çîíû Ôèáîextern int ExtFiboTimeNum = 4;extern bool ExtFiboTimeHH = true;extern bool ExtFiboTimeLH = false;extern bool ExtFiboTimeLL = true;extern bool ExtFiboTimeHL = false;extern color ExtFiboTimeHHC = Teal;extern color ExtFiboTimeLHC = Sienna;extern color ExtFiboTimeLLC = DarkSlateGray;extern color ExtFiboTimeHLC = DimGray;extern bool ExtVisibleDateTime = false;extern string ExtVisibleNumberFiboTime = “1111”;extern string ExtFiboFreeHH = “0.382,0.618,1.0,1.618,2.618”;extern string ExtFiboFreeLH = “0.382,0.618,1.0,1.618,2.618”;extern string ExtFiboFreeLL = “0.382,0.618,1.0,1.618,2.618”;extern string ExtFiboFreeHL = “0.382,0.618,1.0,1.618,2.618”;extern int ExtFiboType = 1;extern string ______________2_____________ = “Common Parameters”;//————————————–extern color ExtObjectColor = CLR_NONE;extern int ExtObjectStyle = 1;extern int ExtObjectWidth = 0;extern bool ExtDinamic = false;extern bool ZigZagHighLow = true;// ——————————–// Äîïîëíèòåëüíûå ôèíêöèè// Âûâîä îáúåêòîâ â âèäå ôîíàextern bool ExtBack = true;// Ñîõðàíåíèå Fibo Timeextern bool ExtSave = false;extern int ExtComplekt = 100;//===================================// Ìàññèâû äëÿ ZigZag// Ìàññèâ äëÿ îòðèñîâêè ZigZagdouble zz[];// Ìàññèâ ìèíèìóìîâ ZigZagdouble zzL[];// Ìàññèâ ìàêñèìóìîâ ZigZagdouble zzH[];// Ìàññèâû äëÿ nen-ZigZagdouble nen_ZigZag[];// Ïåðåìåííûå äëÿ ðàñøèðåííîãî ðåæèìà ðàáîòû èíäèêàòîðàint mft[]={0,0,0,0};int NumWindow = -1; // Íîìåð îêíà ñ èíäèêàòîðîìdouble centrWin = 0;int tiks; // Ñ÷åò÷èê íà÷àëüíûõ òèêîâdouble tret = 0;string nameQTA; // êîðîòêîå èìÿ èíäèêàòîðà äëÿ âû÷èñëåíèÿ îêíà ñ èíäèêàòîðîì// Ïåðåìåííûå äëÿ îñíàñòêèstring nameObj,save;// Ìàòðèöà äëÿ ïîèñêà èñ÷åçíóâøèõ áàðîâ afr – ìàññèâ çíà÷åíèé âðåìåíè ïÿòè ïîñëåäíèõ ôðàêòàëîâ è îòðèñîâêè äèíàìè÷åñêèõ è ñòàòè÷åñêèõ ôèá// afrl – ìèíèìóìû, afrh – ìàêñèìóìûint afr[]={0,0,0,0,0,0,0,0,0,0};double afrl[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrh[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrx[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};string TF[]={“MN”,”W1″,”D1″,”H4″,”H1″,”m30″,”m15″,”m5″,”m1″};string Period_tf;bool afrm=true;bool newRay=true;int k,shift,shift1;//datetime point2; // âðåìÿ 2-îãî ýêñòðåìóìà çèãçàãà. Ïðè åãî èçìåíåíèè ïîÿâëÿåòñÿ íîâûé ëó÷.// Âðåìÿ ñâå÷è ñ ïåðâûì îò íóëåâîãî áàðà ôðàêòàëîìint timeFr1new;// Áàð, äî êîòîðîãî íàäî ïåðåñ÷èòûâàòü îò íóëåâîãî áàðàint numBar=0;// Íîìåð îáúåêòàint numOb;// flagFrNew=true – îáðàçîâàëñÿ íîâûé ôðàêòàë èëè ïåðâûé ôðàêòàë ñìåñòèëñÿ íà äðóãîé áàð. =false – ïî óìîë÷àíèþ.bool flagFrNew=false;// Ïåðèîä òåêóùåãî ãðàôèêàint perTF;int counted_bars, cbi, iBar;// Ïåðåìåííûå äëÿ ZigZag Àëåêñà è èíäèêàòîðà ïîäîáíîãî âñòðîåííîìó â Ensigndouble ha[],la[],hi,li,si,sip,di,hm,lm,ham[],lam[],him,lim,lLast=0,hLast=0;int fs=0,fsp,countBar;int ai,bi,ai0,bi0,aim,bim;datetime tai,tbi,ti;// fcount0 – ïðè îáíóëåíèè ñ÷åò÷èêà ïðîïóùåííûõ áàðîâ íà 0 áàðå fcount0=true.// Íà ñëåäóþùåì áàðå =false è ìîæíî îïðåäåëÿòü òî÷êó ïåðåëîìàbool fh=false,fl=false,fcount0;/*// Ïåðåìåííûå äëÿ Ñâèíãîâ Ãàííàdouble lLast_m=0, hLast_m=0;int countBarExt; // ñ÷åò÷èê âíåøíèõ áàðîâint countBarl,countBarh;*/// Ïåðåìåííûå äëÿ nen-ZigZagbool hi_nen;bool init_zz=true;double hBar, lBar;datetime tiZZ;// Ïåðåìåííûå äëÿ çèãçàãà Talexstatic int endbar = 0;static double endpr = 0;//+——————————————————————+//| Custom indicator initialization function |//+——————————————————————+int init(){string aa;string regim=””, perc;IndicatorBuffers(8);// ——-if (ExtStyleZZ) {SetIndexStyle(0,DRAW_SECTION);}else {SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,158);}SetIndexStyle(3,DRAW_LINE,STYLE_DOT);SetIndexStyle(4,DRAW_LINE,STYLE_DOT);// Óðîâíè ïðåäûäóùèõ ïèêîâSetIndexStyle(1,DRAW_LINE,STYLE_DOT);SetIndexStyle(2,DRAW_LINE,STYLE_DOT);SetIndexBuffer(1,ham);SetIndexBuffer(2,lam);// Óðîâíè ïîäòâåðæäåíèÿSetIndexBuffer(3,ha);SetIndexBuffer(4,la);SetIndexBuffer(0,zz);SetIndexBuffer(5,nen_ZigZag);SetIndexBuffer(6,zzL);SetIndexBuffer(7,zzH);SetIndexStyle(5,DRAW_ARROW);SetIndexArrow(5,159);SetIndexEmptyValue(0,0.0);SetIndexEmptyValue(1,0.0);SetIndexEmptyValue(2,0.0);SetIndexEmptyValue(3,0.0);SetIndexEmptyValue(4,0.0);SetIndexEmptyValue(5,0.0);SetIndexEmptyValue(6,0.0);SetIndexEmptyValue(7,0.0);if (ExtIndicator<6 || ExtIndicator>10){switch (Period()){case 1 : {Period_tf=TF[8];break;}case 5 : {Period_tf=TF[7];break;}case 15 : {Period_tf=TF[6];break;}case 30 : {Period_tf=TF[5];break;}case 60 : {Period_tf=TF[4];break;}case 240 : {Period_tf=TF[3];break;}case 1440 : {Period_tf=TF[2];break;}case 10080 : {Period_tf=TF[1];break;}case 43200 : {Period_tf=TF[0];break;}}}else{switch (GrossPeriod){case 1 : {Period_tf=TF[8];break;}case 5 : {Period_tf=TF[7];break;}case 15 : {Period_tf=TF[6];break;}case 30 : {Period_tf=TF[5];break;}case 60 : {Period_tf=TF[4];break;}case 240 : {Period_tf=TF[3];break;}case 1440 : {Period_tf=TF[2];break;}case 10080 : {Period_tf=TF[1];break;}case 43200 : {Period_tf=TF[0];break;}}if (GrossPeriod>43200){if (MathMod(GrossPeriod,43200)>0) Period_tf=GrossPeriod; else Period_tf=TF[0]+GrossPeriod/43200 + “”;}else if (GrossPeriod<43200){if (GrossPeriod>10080){if (MathMod(GrossPeriod,10080)>0) Period_tf=GrossPeriod; else Period_tf=”W”+GrossPeriod/10080 + “”;}else if (GrossPeriod<10080){if (GrossPeriod>1440){if (MathMod(GrossPeriod,1440)>0) Period_tf=GrossPeriod; else Period_tf=”D”+GrossPeriod/1440 + “”;}else if (GrossPeriod<1440){if (GrossPeriod!=60){if (MathMod(GrossPeriod,60)>0) Period_tf=GrossPeriod; else Period_tf=”H”+GrossPeriod/60 + “”;}}}}}if (minPercent>0) perc=DoubleToStr(MathAbs(minPercent),1); else perc=”0.0″;switch (ExtIndicator){case 0 : {regim=” | “+ ExtIndicator + ” / ” + minBars + ” / ” + ExtDeviation + ” / ” + ExtBackstep; break;}case 1 : {regim=” | “+ ExtIndicator + ” / ” + minSize + ” / ” + perc+” %”; break;}case 2 : {regim=” | “+ ExtIndicator + ” / ” + minBars + “/” + minSize; break;}case 3 : {regim=” | “+ ExtIndicator + ” / ” + minBars; break;}case 4 : {regim=” | “+ ExtIndicator + ” / ” + minSize; break;}case 5 : {regim=” | “+ ExtIndicator + ” / ” + minBars; break;}case 6 : {regim=” | “+ ExtIndicator + ” / ” + GrossPeriod + ” / ” + minBars + ” / ” + ExtDeviation + ” / ” + ExtBackstep; break;}case 7 : {regim=” | “+ ExtIndicator + ” / ” + GrossPeriod + ” / ” + minBars; break;}case 8 : {regim=” | “+ ExtIndicator + ” / ” + GrossPeriod + ” / ” + minBars + ” / ” + ExtDeviation; break;}case 10 : {regim=” | “+ ExtIndicator + ” / ” + GrossPeriod + ” / ” + minBars; break;}case 11 : {regim=” | “+ ExtIndicator; break;}case 12 : {regim=” | “+ ExtIndicator + ” / ” + minSize; break;}case 13 : {regim=” | “+ ExtIndicator + ” / ” + minBars + ” / ” + minSize; break;}// case 14 : {regim=” | “+ ExtIndicator + ” / ” + StLevel + ” / ” + BigLevel + ” / ” + minBars; break;}}nameQTA=”QTA “+Symbol()+” “+Period_tf + regim;IndicatorShortName(nameQTA);if (ExtIndicator==1) if (minSize!=0) di=minSize*Point/2;if (ExtIndicator==2) {di=minSize*Point; countBar=minBars;}if (ExtIndicator==3) {countBar=minBars;}if (ExtIndicator<6 ||ExtIndicator>10) GrossPeriod=Period();if (ExtFiboType<0) ExtFiboType=0;if (ExtFiboType>2) ExtFiboType=2;// Ïðîâåðêà ïðàâèëüíîñòè ââåäåííûõ âíåøíèõ ïåðåìåííûõif (ExtFiboTimeNum<=1) ExtFiboTimeNum=0;if (ExtFiboTimeNum>9999) ExtFiboTimeNum=0;aa=DoubleToStr(ExtFiboTimeNum,0);mft[0]=StrToInteger(StringSubstr(aa,0,1));mft[1]=StrToInteger(StringSubstr(aa,1,1));mft[2]=StrToInteger(StringSubstr(aa,2,1));mft[3]=StrToInteger(StringSubstr(aa,3,1));ArraySort(mft,WHOLE_ARRAY,0,MODE_DESCEND);if (mft[0]<3) ExtFiboTimeNum=0;else{if (mft[1]==1) mft[1]++;if (mft[1]==0) {mft[1]=mft[0]-1; mft[2]=mft[1]-1;}if (mft[2]==0) mft[2]=mft[1]-1;if (mft[3]==0 && StringLen(aa)<4) mft[3]=mft[2]-1;}tiks = -1;if (ExtSave){MathSrand(LocalTime());save=MathRand();}perTF=Period();return(0);}//+——————————————————————+//| Äåèíèöèàëèçàöèÿ. Óäàëåíèå âñåõ òðåíäîâûõ ëèíèé è òåêñòîâûõ îáúåêòîâ//+——————————————————————+int deinit(){delete_objects_number();ObjectDelete(“ftHH”+ ExtComplekt+”_” + nameQTA );ObjectDelete(“ftLH”+ ExtComplekt+”_” + nameQTA );ObjectDelete(“ftLL” + ExtComplekt+”_” + nameQTA);ObjectDelete(“ftHL”+ ExtComplekt+”_” + nameQTA );return(0);}//********************************************************int start() // ÍÀ×ÀËÎ{if ((ExtIndicator==6 || ExtIndicator==7 || ExtIndicator==8 || ExtIndicator==10) && Period()>GrossPeriod){ArrayInitialize(zz,0);ArrayInitialize(zzL,0);ArrayInitialize(zzH,0);ArrayInitialize(nen_ZigZag,0);init_zz=true;return;}counted_bars=IndicatorCounted();if (NumWindow<1){if (WindowFind(nameQTA)>=0) NumWindow=WindowFind(nameQTA);else{if (WindowsTotal()==2) NumWindow=1;}}if (tiks<2){tiks++;centrWin=(WindowPriceMax(NumWindow) + WindowPriceMin(NumWindow))/2;tret=(WindowPriceMax(NumWindow)-centrWin)/3;}if (perTF!=Period()){perTF=Period();}//—————————————–//// 1.//// Áëîê çàïîëíåíèÿ áóôåðîâ. Íà÷àëî.//—————————————–// zz[] – áóôåð, äàííûå èç êîòîðîãî áåðóòñÿ äëÿ îòðèñîâêè ñàìîãî ZigZag-a// zzL[] – ìàññèâ ìèíèìóìîâ ÷åðíîâîé// zzH[] – ìàññèâ ìàêñèìóìîâ ÷åðíîâîé////—————————————–if (Bars-IndicatorCounted()>2){cbi=Bars-1; tiZZ=0;if (ExtIndicator==1) {ti=0; ai=0; bi=0; tai=0; tbi=0; fs=0; si=0; sip=0;} lBar=0; hBar=0;ArrayInitialize(zz,0);ArrayInitialize(zzL,0);ArrayInitialize(zzH,0);ArrayInitialize(nen_ZigZag,0);init_zz=true; afrm=true;delete_objects_number();}else{if (ExtIndicator==1) cbi=Bars-IndicatorCounted()-1;else cbi=Bars-IndicatorCounted();if (lBar<=iLow(NULL,GrossPeriod,0) && hBar>=iHigh(NULL,GrossPeriod,0) && tiZZ==iTime(NULL,GrossPeriod,0)) return(0);else{lBar=iLow(NULL,GrossPeriod,0); hBar=iHigh(NULL,GrossPeriod,0); tiZZ=iTime(NULL,GrossPeriod,0);}}switch (ExtIndicator){case 0 : {ZigZag_(); break;}case 1 : {ang_AZZ_(); break;}case 2 : {Ensign_ZZ(); break;}case 3 : {Ensign_ZZ(); break;}case 4 : {ZigZag_tauber();break;}case 5 : {GannSwing(); break;}case 6 : {nenZigZag(); break;} // DT-ZigZag – ñ èñïðàâëåííûì, îïòèìèçèðîâàííûì çèãçàãîì ZigZag_new_nen3.mq4case 7 : {nenZigZag(); break;} // DT-ZigZag – âàðèàíò çèãçàãà, êîòîðûé ëþáåçíî ïðåäîñòàâèë klot – DT_ZZ.mq4case 8 : {nenZigZag(); break;} // DT-ZigZag – âàðèàíò çèãçàãà, êîòîðûé ëþáåçíî ïðåäîñòàâèë Candid – CZigZag.mq4case 10 : {nenZigZag(); break;} // DT-ZigZag – âàðèàíò çèãçàãà ExtIndicator=5 â ðåæèìå DT – âíåøíèé çèãçàã Swing_zz.mq4case 12 : {ZZTalex(minBars);break;}case 13 : {ZigZag_SQZZ();break;} // ZigZag òîâàðîâåäà}matriza();//—————————————–// Áëîê çàïîëíåíèÿ áóôåðîâ. Êîíåö.//—————————————–//—————————————–// Áëîê ïðîâåðîê. Íà÷àëî.//—————————————–if (Bars – counted_bars<3){// Ïîèñê âðåìåíè áàðà ïåðâîãî ýêñòðåìóìà, ñ÷èòàÿ îò íóëåâîãî áàðàfor (shift1=0; shift1<Bars; shift1++){if (zz[shift1]>0.0 && (zzH[shift1]==zz[shift1] || zzL[shift1]==zz[shift1])){timeFr1new=Time[shift1];break;}}// Ïîèñê áàðà, íà êîòîðîì ïåðâûé ýêñòðåìóì áûë ðàíåå.shift=iBarShift(Symbol(),Period(),afr[0]);// Ñðàâíåíèå òåêóùåãî çíà÷åíèÿ ýêñòðåìóìà ñ òåì, êîòîðûé áûë ðàíåå// Ïîÿâèëñÿ íîâûé ëó÷ ZigZagif ((zzH[shift1]>0 && afrl[0]>0) || (zzL[shift1]>0 && afrh[0]>0)){if (!ExtDinamic){newRay=true;ExtNumberPeak=false;if (mft[3]>0 && tiks>1) ExtFiboTimeNum=0;}}// Îáðàçîâàëñÿ íîâûé ýêñòðåìóìif (timeFr1new!=afr[0]){flagFrNew=true;if (shift>=shift1) numBar=shift; else numBar=shift1;afrm=true;}// Ýêñòðåìóì íà ìàêñèìóìå ñäâèíóëñÿ íà äðóãîé áàðif (afrh[0]>0 && zz[shift]==0.0){flagFrNew=true;if (numBar<shift) numBar=shift;if (ExtFiboTimeNum>3 && mft[3]==0) fiboTimeX();afrm=true;}// Ýêñòðåìóì íà ìèíèìóìå ñäâèíóëñÿ íà äðóãîé áàðif (afrl[0]>0 && zz[shift]==0.0){flagFrNew=true;if (numBar<shift) numBar=shift;if (ExtFiboTimeNum>3 && mft[3]==0) fiboTimeX();afrm=true;}//———–3 Ñìåñòèëñÿ ìàêñèìóì èëè ìèíèìóì, íî îñòàëñÿ íà òîì æå áàðå. Íà÷àëî.//============= 1 ñìåñòèëñÿ ìàêñèìóì. Íà÷àëî.if (afrh[0]-High[shift]!=0 && afrh[0]>0){flagFrNew=true;numBar=0;afrx[0]=High[shift];afrh[0]=High[shift];}//============= 1 ñìåñòèëñÿ ìàêñèìóì. Êîíåö.////============= 1 ñìåñòèëñÿ ìèíèìóì. Íà÷àëî.if (afrl[0]-Low[shift]!=0 && afrl[0]>0){flagFrNew=true;numBar=0;afrx[0]=Low[shift];afrl[0]=Low[shift];}//============= 1 ñìåñòèëñÿ ìèíèìóì. Êîíåö.//———–3 Ñìåñòèëñÿ ìàêñèìóì èëè ìèíèìóì, íî îñòàëñÿ íà òîì æå áàðå. Êîíåö.matriza (); // Ïåðåçàïèñü ìàòðèöû.}//—————————————–// Áëîê ïðîâåðîê. Êîíåö.//—————————————–} // start // ÊÎÍÅÖ//—————————————————-// Ïîäïðîãðàììû è ôóíêöèè//—————————————————-//——————————————————–// Ôîðìèðîâàíèå ìàòðèöû. Íà÷àëî.//// Ìàòðèöà èñïîëüçóåòñÿ äëÿ ïîèñêà èñ÷åçíóâøèõ ýêñòðåìóìîâ.// Ýòî èíñòðóìåíò êîìïåíñàöèè íåïðåäâèäåííûõ çàêèäîíîâ ñòàíäàðòíîãî ZigZag-a.//——————————————————void matriza(){if (afrm || tiks<2){afrm=false;int shift,k;k=0;for (shift=0; shift<Bars && k<10; shift++){if (zz[shift]>0){afrx[k]=zz[shift];afr[k]=Time[shift];if (zz[shift]==zzL[shift]){if (ZigZagHighLow) afrl[k]=Low[shift];else{if (k==0) afrl[k]=Low[shift]; else afrl[k]=zzL[shift];}afrh[k]=0.0;}if (zz[shift]==zzH[shift]){if (ZigZagHighLow) afrh[k]=High[shift];else{if (k==0) afrh[k]=High[shift]; else afrh[k]=zzH[shift];}afrl[k]=0.0;}k++;}}if ((newRay || mft[3]==0 || tiks<2) && ExtFiboTimeNum>2) fiboTimeX();ExtSave=false;}if (newRay && ExtNumberPeak) NumberPeak();newRay=false;}//——————————————————–// Ôîðìèðîâàíèå ìàòðèöû. Êîíåö.//——————————————————–//——————————————————–// Âûâîä íîìåðîâ ïåðåëîìîâ çèãçàãîâ. Íà÷àëî//——————————————————–void NumberPeak(){int n=0,i,endNumber;string txt;if (ExtNumberPeak10) endNumber=iBarShift(Symbol(),Period(),afr[9]); else endNumber=Bars-minBars;delete_objects_number();for (i=iBarShift(Symbol(),Period(),afr[0])+1;i<endNumber;i++){if (zz[i]>0){n++;if (ExtNumberPeakLow){if (zzL[i]>0){txt=DoubleToStr(n,0);nameObj=”NPqta” + “_” + ExtComplekt + “_” + n;ObjectCreate(nameObj,OBJ_TEXT,NumWindow,Time[i],zz[i]);ObjectSetText(nameObj,txt,ExtNumberPeakFontSize,”Arial”,ExtNumberPeakColor);}}else{txt=DoubleToStr(n,0);nameObj=”NPqta” + “_” + ExtComplekt + “_” + n;ObjectCreate(nameObj,OBJ_TEXT,NumWindow,Time[i],zz[i]);ObjectSetText(nameObj,txt,ExtNumberPeakFontSize,”Arial”,ExtNumberPeakColor);}}}}//——————————————————–// Âûâîä íîìåðîâ ïåðåëîìîâ çèãçàãîâ. Êîíåö//——————————————————–//——————————————————–// Óäàëåíèå îáúåêòîâ. Íà÷àëî.// Óäàëåíèå íîìåðîâ ïåðåëîìîâ çèãçàãà.//——————————————————–void delete_objects_number(){int i;string txt;for (i=ObjectsTotal(); i>=0; i–){txt=ObjectName(i);if (StringFind(txt,”NPqta” + “_” + ExtComplekt + “_”)>-1) ObjectDelete (txt);}}//——————————————————–// Óäàëåíèå îáúåêòîâ. Êîíåö.// Óäàëåíèå íîìåðîâ ïåðåëîìîâ çèãçàãà.//——————————————————–//——————————————————–// ôèáî-Time. Íà÷àëî.//——————————————————–void fiboTimeX(){double cenaFT;if (ExtFiboTimeHH){nameObj=”FThh” + ExtComplekt+”_” + nameQTA;if (ExtSave){nameObj=nameObj + save;}ObjectDelete(nameObj);cenaFT=centrWin + 2*tret;if (afrx[mft[0]]>afrx[mft[1]]){ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[0]],cenaFT,afr[mft[2]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeHHC);fiboTime (nameObj, afr[mft[0]], afr[mft[2]]-afr[mft[0]], 0, “HH_”);}else{ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[1]],cenaFT,afr[mft[3]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeHHC);fiboTime (nameObj, afr[mft[1]], afr[mft[3]]-afr[mft[1]], 0, “HH_”);}}if (ExtFiboTimeLH){nameObj=”FTlh” + ExtComplekt+”_” + nameQTA;if (ExtSave){nameObj=nameObj + save;}ObjectDelete(nameObj);cenaFT=centrWin + tret;if (afrx[mft[0]]>afrx[mft[1]]){ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[1]],cenaFT,afr[mft[2]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeLHC);fiboTime (nameObj, afr[mft[1]], afr[mft[2]]-afr[mft[1]], 1, “LH_”);}elseObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[2]],cenaFT,afr[mft[3]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeLHC);fiboTime (nameObj, afr[mft[1]], afr[mft[2]]-afr[mft[1]], 1, “LH_”);}if (ExtFiboTimeLL){nameObj=”FTll” + ExtComplekt+”_” + nameQTA;if (ExtSave){nameObj=nameObj + save;}ObjectDelete(nameObj);cenaFT=centrWin-2*tret;if (afrx[mft[0]]<afrx[mft[1]]){ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[0]],cenaFT,afr[mft[2]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeLLC);fiboTime (nameObj, afr[mft[0]], afr[mft[2]]-afr[mft[0]], 2, “LL_”);}else{ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[1]],cenaFT,afr[mft[3]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeLLC);fiboTime (nameObj, afr[mft[1]], afr[mft[3]]-afr[mft[1]], 2, “LL_”);}}if (ExtFiboTimeHL){nameObj=”FThl” + ExtComplekt+”_” + nameQTA;if (ExtSave){nameObj=nameObj + save;}ObjectDelete(nameObj);cenaFT=centrWin-tret;if (afrx[mft[0]]<afrx[mft[1]]){ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[1]],cenaFT,afr[mft[2]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeHLC);fiboTime (nameObj, afr[mft[1]], afr[mft[2]]-afr[mft[1]], 3, “HL_”);}else{ObjectCreate(nameObj,OBJ_FIBOTIMES,NumWindow,afr[mft[2]],cenaFT,afr[mft[3]],cenaFT);ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboTimeHLC);fiboTime (nameObj, afr[mft[2]], afr[mft[3]]-afr[mft[2]], 3, “HL_”);}}}//——————————————————–// ôèáî-Time. Êîíåö.//——————————————————–//——————————————————–// ôèáî-Time. Íà÷àëî.//——————————————————–void fiboTime (string nameObj, datetime t1, datetime t2, int number, string ftx){string strFibo;ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor);ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle);ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth);ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT);ObjectSet(nameObj,OBJPROP_BACK,ExtBack);if (ExtFiboType==1){ObjectSet(nameObj,OBJPROP_FIBOLEVELS,17);fiboTimeP (nameObj, t1, t2, number, ftx);}else if (ExtFiboType==0){ObjectSet(nameObj,OBJPROP_FIBOLEVELS,17);fiboTimeS (nameObj, t1, t2, number, ftx);}else if (ExtFiboType==2){if (number==0){strFibo=ExtFiboFreeHH;}else if (number==1){strFibo=ExtFiboFreeLH;}else if (number==2){strFibo=ExtFiboFreeLL;}else if (number==3){strFibo=ExtFiboFreeHL;}ObjectSet(nameObj,OBJPROP_FIBOLEVELS, quantityFibo(strFibo)+3);fiboTimeFree (nameObj, t1, t2, number, strFibo, ftx);}}//——————————————————–// ôèáî-Time. Êîíåö.//——————————————————–//——————————————————–// Ôèáû ôèáî-Time ñ ÷èñëàìè Ïåñàâåíòî. Íà÷àëî.//——————————————————–void fiboTimeP (string nameObj, datetime t1, datetime t2, int number, string ftx){int ftvisibleDT;string ftvisible;if (ExtFiboTimeNum>2){ftvisibleDT=ExtVisibleDateTime;ftvisible=ExtVisibleNumberFiboTime;}double fi_1[]={0.0, 1.0, 1.382, 1.5, phi, 1.786, 1.886, 2.0, 2.272, 2.618, 3.0, 3.618, 4.0};string fitxt100_1[]={“0”, “1.0”, “.382”, “.5”, “.618”, “.786”, “.886”, “1.0”, “1.272”, “1.618”, “2.0”, “2.618”, “3.0”};for (int i=0; i<=12; i++){ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+i,fi_1[i]);if (ftvisibleDT && StringSubstr(ftvisible,number,1)==”1″){ObjectSetFiboDescription(nameObj, i, ftx + fitxt100_1[i] + ” ” + TimeToStr(t1 + t2*fi_1[i],TIME_DATE|TIME_MINUTES));}else{ObjectSetFiboDescription(nameObj, i, ftx + fitxt100_1[i]);}}}//——————————————————–// Ôèáû ôèáî-Time ñ ÷èñëàìè Ïåñàâåíòî ôèáî-Time. Êîíåö.//——————————————————–//——————————————————–// Ôèáû ôèáî-Time ñî ñòàíäàðòíûìè ÷èñëàìè. Íà÷àëî.//——————————————————–void fiboTimeS (string nameObj, datetime t1, datetime t2, int number, string ftx){int ftvisibleDT;string ftvisible;if (ExtFiboTimeNum>2){ftvisibleDT=ExtVisibleDateTime;ftvisible=ExtVisibleNumberFiboTime;}double fi_1[]={0.0, 1.0, 1.146, 1.236, 1.382, 1.5, phi, 1.764, 1.854, 2.0, 2.236, 2.382, 2.618, 3.0, 3.618, 4.0, 5.0};string fitxt100_1[]={“0”, “1.0”, “.146”, “.236”, “.382”, “.5”, “.618”, “.764”, “.854”, “1.0”, “1.236”, “1.382”, “1.618”, “2.0”, “2.618”, “3.0”, “4.0”};for (int i=0; i<=16; i++){ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+i,fi_1[i]);if (ftvisibleDT && StringSubstr(ftvisible,number,1)==”1″){ObjectSetFiboDescription(nameObj, i, ftx + fitxt100_1[i] + ” ” + TimeToStr(t1 + t2*fi_1[i],TIME_DATE|TIME_MINUTES));}else{ObjectSetFiboDescription(nameObj, i, ftx + fitxt100_1[i]);}}}//——————————————————–// Ôèáû ôèáî-Time ñî ñòàíäàðòíûìè ÷èñëàìè. Êîíåö.//——————————————————–//——————————————————–// Ôèáû ôèáî-Time ñ ïîëüçîâàòåëüñêèìè ÷èñëàìè. Íà÷àëî.//——————————————————–void fiboTimeFree (string nameObj, datetime t1, datetime t2, int number, string strFibo, string ftx){int ftvisibleDT;string ftvisible;if (ExtFiboTimeNum>2){ftvisibleDT=ExtVisibleDateTime;ftvisible=ExtVisibleNumberFiboTime;}string str, str1;double fi;int j,k;j=quantityFibo (strFibo);ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+0,0.0);ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+1,1.0);if (ftvisibleDT && StringSubstr(ftvisible,number,1)==”1″){ObjectSetFiboDescription(nameObj, 0, ftx + “0” + ” ” + TimeToStr(t1,TIME_DATE|TIME_MINUTES));ObjectSetFiboDescription(nameObj, 1, ftx + “1.0” + ” ” + TimeToStr(t1 + t2,TIME_DATE|TIME_MINUTES));}else{ObjectSetFiboDescription(nameObj, 0, ftx + “0”);ObjectSetFiboDescription(nameObj, 1, ftx + “1.0”);}str=strFibo;for (int i=0; i<=j; i++){k=StringFind(str, “,”, 0);str1=StringTrimLeft(StringTrimRight(StringSubstr(str,0,k)));fi=StrToDouble(str1);if (fi<1) str1=StringSubstr(str1,1);ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+(i+2),fi+1);if (ftvisibleDT && StringSubstr(ftvisible,number,1)==”1″){ObjectSetFiboDescription(nameObj, i+2, ftx + str1 + ” ” + TimeToStr(t1 + t2*(fi+1),TIME_DATE|TIME_MINUTES));}else{ObjectSetFiboDescription(nameObj, i+2, ftx + str1);}if (k>=0) str=StringSubstr(str,k+1);}}//——————————————————–// Ôèáû ôèáî-Time ñ ïîëüçîâàòåëüñêèìè ÷èñëàìè. Êîíåö.//——————————————————–//——————————————————–// Ñ÷åò÷èê ôèá. Íà÷àëî.//——————————————————–int quantityFibo (string sFibo){int j=0,i,k;while (true){k=StringFind(sFibo, “,”,i+1);if (k>0) {j++; i=k;}else return (j);}}//——————————————————–// Ñ÷åò÷èê ôèá. Êîíåö.//——————————————————–//—————————————————-// ZigZag (èç ÌÒ4 íåìíîãî èçìåíåííûé). Íà÷àëî.//—————————————————-void ZigZag_(){// ZigZag èç ÌÒ. Íà÷àëî.int shift, back,lasthighpos,lastlowpos;double val,res;double curlow,curhigh,lasthigh,lastlow;int vDepth = 0;int Depth;bool endCyklDirection=true;Depth = minBars;// ïåðâûé áîëüøîé öèêëfor(shift=Bars-Depth; shift>=0; shift–){val=Low[iLowest(NULL,0,MODE_LOW,Depth,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=zzL[shift+back];if((res!=0)&&(res>val)) zzL[shift+back]=0.0;}}}if (Low[shift]==val){zzL[shift]=val;}val=High[iHighest(NULL,0,MODE_HIGH,Depth,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=zzH[shift+back];if((res!=0)&&(res<val)) zzH[shift+back]=0.0;}}}if (High[shift]==val){zzH[shift]=val;}}// âòîðîé áîëüøîé öèêëlasthigh=-1; lasthighpos=-1;lastlow=-1; lastlowpos=-1;for(shift=Bars-Depth; shift>=0; shift–){curlow=zzL[shift];curhigh=zzH[shift];if((curlow==0)&&(curhigh==0)) continue;if(curhigh!=0){if(lasthigh>0){if(lasthigh<curhigh) zzH[lasthighpos]=0;else zzH[shift]=0;}if(lasthigh<curhigh || lasthigh<0){lasthigh=curhigh;lasthighpos=shift;}lastlow=-1;}if(curlow!=0){if(lastlow>0){if(lastlow>curlow) zzL[lastlowpos]=0;else zzL[shift]=0;}if((curlow<lastlow)||(lastlow<0)){lastlow=curlow;lastlowpos=shift;}lasthigh=-1;}}// òðåòèé áîëüøîé öèêëfor(shift=Bars-1; shift>=0; shift–){zz[shift]=zzL[shift];if(shift>=Bars-Depth) {zzH[shift]=0.0; zzL[shift]=0.0; zz[shift]=0.0;}else{res=zzH[shift];if(res!=0.0){zz[shift]=res;}}}NoGorb(Depth); // óäàëÿåì ãîðáû çèãçàãà}//——————————————————–// ZigZag èç ÌÒ. Êîíåö.//——————————————————–//——————————————————–// Èñïðàâëåíèå âîçíèêàþùèõ ãîðáîâ çèãçàãà. Íà÷àëî.//——————————————————–void NoGorb(int Depth){double vel1, vel2, vel3, vel4;int bar1, bar2, bar3, bar4;int count;for(int bar=Bars-Depth; bar>=0; bar–){if (zz[bar]!=0){count++;vel4=vel3;bar4=bar3;vel3=vel2;bar3=bar2;vel2=vel1;bar2=bar1;vel1=zz[bar];bar1=bar;if (count<3) continue;if ((vel3<vel2)&&(vel2<vel1)) {zz[bar2]=0;zzL[bar2]=0;zzH[bar2]=0;bar=bar3+1;}if ((vel3>vel2)&&(vel2>vel1)) {zz[bar2]=0;zzL[bar2]=0;zzH[bar2]=0;bar=bar3+1;}if ((vel2==vel1)&&(vel1!=0 )) {zz[bar1]=0;zzL[bar1]=0;zzH[bar1]=0;bar=bar3+1;}}}}//——————————————————–// Èñïðàâëåíèå âîçíèêàþùèõ ãîðáîâ çèãçàãà. Êîíåö.//——————————————————–//—————————————————-// ZigZag Àëåêñà íåìíîãî èçìåíåííûé. Íà÷àëî.//—————————————————-void ang_AZZ_(){int i,n;// cbi=Bars-IndicatorCounted()-1;//———————————for (i=cbi; i>=0; i–){//————————————————-// çàïîìèíàåì çíà÷åíèå íàïðàâëåíèÿ òðåíäà fs è ñðåäíåé öåíû si íà ïðåäûäóùåì áàðåif (ti<Time[i]) {fsp=fs; sip=si;} ti=Time[i];// Âû÷èñëÿåì çíà÷åíèå öåíîâîãî ôèëüòðà îò ïðîöåíòà îòêëîíåíèÿif (minSize==0 && minPercent!=0) di=minPercent*Close[i]/2/100;//————————————————-// Êîððåêòèðîâêà ñðåäíåé öåíûif (High[i]>si+di && Low[i]<si-di) // Âíåøíèé áàð ïî îòíîøåíèþ ê öåíîâîìó ôèëüòðó di{// if (High[i]-si>si-Low[i]) si=High[i]-di; // Îòêëîíåíèå õàÿ îò ñðåäíåé öåíû áîëüøå îòêëîíåíèÿ ëîâà// else if (High[i]-si<si-Low[i]) si=Low[i]+di; // ñîîòâåòñòâåííî, ìåíüøåif (fs==1) si=High[i]-di; //if (fs==2) si=Low[i]+di; //}else // Íå âíåøíèé áàð{if (fs==1){if (High[i]>=si+di) si=High[i]-di; //else if (Low[i]<si-di) si=Low[i]+di; //}if (fs==2){if (Low[i]<=si-di) si=Low[i]+di; //else if (High[i]>si+di) si=High[i]-di; //}}// Âû÷èñëåíèå íà÷àëüíîãî çíà÷åíèÿ ñðåäíåé öåíûif (i>Bars-2) {si=(High[i]+Low[i])/2;}// Îïðåäåëÿåì íàïðàâëåíèå òðåíäà äëÿ ðàñ÷åòíîãî áàðàif (si>sip) fs=1; // Òðåíä âîñõîäÿùèéif (si<sip) fs=2; // Òðåíä íèñõîäÿùèé//————————————————-if (fs==1 && fsp==2) // Òðåäí ñìåíèëñÿ ñ íèñõîäÿùåãî íà âîñõîäÿùèé{hm=High[i];bi=iBarShift(Symbol(),Period(),tbi);zz[bi]=Low[bi];zzL[bi]=Low[bi];tai=Time[i];fsp=fs;si=High[i]-di;sip=si;}if (fs==2 && fsp==1) // Òðåäí ñìåíèëñÿ ñ âîñõîäÿùåãî íà íèñõîäÿùèé{lm=Low[i];ai=iBarShift(Symbol(),Period(),tai);zz[ai]=High[ai];zzH[ai]=High[ai];tbi=Time[i];si=Low[i]+di;fsp=fs;sip=si;}// Ïðîäîëæåíèå tðåíäà. Îòñëåæèâàíèå òðåíäà.if (fs==1 && High[i]>hm){hm=High[i]; tai=Time[i]; si=High[i]-di;}if (fs==2 && Low[i]<lm){lm=Low[i]; tbi=Time[i]; si=Low[i]+di;}//===================================================================================================// Íóëåâîé áàð. Ðàñ÷åò ïåðâîãî ëó÷à ZigZag-aif (i==0){ai0=iBarShift(Symbol(),Period(),tai);bi0=iBarShift(Symbol(),Period(),tbi);if (fs==1){for (n=bi0-1; n>=0; n–) {zzH[n]=0; zz[n]=0;}zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0;}if (fs==2){for (n=ai0-1; n>=0; n–) {zzL[n]=0; zz[n]=0;}zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0;}}//====================================================================================================}//——————————————–}//——————————————————–// ZigZag Àëåêñà. Êîíåö.//——————————————————–//—————————————————-// Èíäèêàòîð ïîäîáíûé âñòðîåííîìó â Ensign. Íà÷àëî.//—————————————————-void Ensign_ZZ(){int i,n;// cbi=Bars-IndicatorCounted()-1;//———————————for (i=cbi; i>=0; i–){//————————————————-// Óñòàíàâëèâàåì íà÷àëüíûå çíà÷åíèÿ ìèíèìóìà è ìàêñèìóìà áàðàif (lLast==0) {lLast=Low[i];hLast=High[i]; if (ExtIndicator==3) di=hLast-lLast;}// Îïðåäåëÿåì íàïðàâëåíèå òðåíäà äî ïåðâîé òî÷êè ñìåíû òðåíäà.// Èëè äî òî÷êè íà÷àëà ïåðâîãî ëó÷à çà ëåâûì êðàåì.if (fs==0){if (lLast<Low[i] && hLast<High[i]) {fs=1; hLast=High[i]; si=High[i]; ai=i; tai=Time[i]; if (ExtIndicator==3) di=High[i]-Low[i];} // òðåíä âîñõîäÿùèéif (lLast>Low[i] && hLast>High[i]) {fs=2; lLast=Low[i]; si=Low[i]; bi=i; tbi=Time[i]; if (ExtIndicator==3) di=High[i]-Low[i];} // òðåíä íèñõîäÿùèé}if (ti<Time[i]){// çàïîìèíàåì çíà÷åíèå íàïðàâëåíèÿ òðåíäà fs íà ïðåäûäóùåì áàðåti=Time[i];ai0=iBarShift(Symbol(),Period(),tai);bi0=iBarShift(Symbol(),Period(),tbi);fcount0=false;if ((fh || fl) && countBar>0) {countBar–; if (i==0 && countBar==0) fcount0=true;}// Îñòàíîâêà. Îïðåäåëåíèå äàëüíåéøåãî íàïðàâëåíèÿ òðåíäà.if (fs==1){if (hLast>High[i] && !fh) fh=true;if (i==0){if (Close[i+1]<lLast && fh) {fs=2; countBar=minBars; fh=false;}if (countBar==0 && si-di>Low[i+1] && High[i+1]<hLast && ai0>i+1 && fh && !fcount0) {fs=2; countBar=minBars; fh=false;}if (fs==2) // Òðåäí ñìåíèëñÿ ñ âîñõîäÿùåãî íà íèñõîäÿùèé íà ïðåäûäóùåì áàðå{zz[ai0]=High[ai0];zzH[ai0]=High[ai0];lLast=Low[i+1];if (ExtIndicator==3) di=High[i+1]-Low[i+1];si=Low[i+1];bi=i+1;tbi=Time[i+1];}}else{if (Close[i]<lLast && fh) {fs=2; countBar=minBars; fh=false;}if (countBar==0 && si-di>Low[i] && High[i]<hLast && fh) {fs=2; countBar=minBars; fh=false;}if (fs==2) // Òðåäí ñìåíèëñÿ ñ âîñõîäÿùåãî íà íèñõîäÿùèé{zz[ai]=High[ai];zzH[ai]=High[ai];lLast=Low[i];if (ExtIndicator==3) di=High[i]-Low[i];si=Low[i];bi=i;tbi=Time[i];}}}else // fs==2{if (lLast<Low[i] && !fl) fl=true;if (i==0){if (Close[i+1]>hLast && fl) {fs=1; countBar=minBars; fl=false;}if (countBar==0 && si+di<High[i+1] && Low[i+1]>lLast && bi0>i+1 && fl && !fcount0) {fs=1; countBar=minBars; fl=false;}if (fs==1) // Òðåäí ñìåíèëñÿ ñ íèñõîäÿùåãî íà âîñõîäÿùèé íà ïðåäûäóùåì áàðå{zz[bi0]=Low[bi0];zzL[bi0]=Low[bi0];hLast=High[i+1];if (ExtIndicator==3) di=High[i+1]-Low[i+1];si=High[i+1];ai=i+1;tai=Time[i+1];}}else{if (Close[i]>hLast && fl) {fs=1; countBar=minBars; fl=false;}if (countBar==0 && si+di<High[i] && Low[i]>lLast && fl) {fs=1; countBar=minBars; fl=false;}if (fs==1) // Òðåäí ñìåíèëñÿ ñ íèñõîäÿùåãî íà âîñõîäÿùèé{zz[bi]=Low[bi];zzL[bi]=Low[bi];hLast=High[i];if (ExtIndicator==3) di=High[i]-Low[i];si=High[i];ai=i;tai=Time[i];}}}}// Ïðîäîëæåíèå òðåíäàif (fs==1 && High[i]>si) {ai=i; tai=Time[i]; hLast=High[i]; si=High[i]; countBar=minBars; fh=false; if (ExtIndicator==3) di=High[i]-Low[i];}if (fs==2 && Low[i]<si) {bi=i; tbi=Time[i]; lLast=Low[i]; si=Low[i]; countBar=minBars; fl=false; if (ExtIndicator==3) di=High[i]-Low[i];}//===================================================================================================// Íóëåâîé áàð. Ðàñ÷åò ïåðâîãî ëó÷à ZigZag-aif (i==0){ai0=iBarShift(Symbol(),Period(),tai);bi0=iBarShift(Symbol(),Period(),tbi);if (fs==1){for (n=bi0-1; n>=0; n–) {zzH[n]=0; zz[n]=0;}zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0;}if (fs==2){for (n=ai0-1; n>=0; n–) {zzL[n]=0; zz[n]=0;}zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0;}}//====================================================================================================}//——————————————–}//——————————————————–// Èíäèêàòîð ïîäîáíûé âñòðîåííîìó â Ensign. Êîíåö.//——————————————————–//—————————————————-// ZigZag tauber. Íà÷àëî.//—————————————————-void ZigZag_tauber(){// ZigZag èç ÌÒ. Íà÷àëî.int shift, back,lasthighpos,lastlowpos;double val,res;double curlow,curhigh,lasthigh,lastlow;ArrayInitialize(zz,0.0);ArrayInitialize(zzL,0.0);ArrayInitialize(zzH,0.0);GetHigh(0,Bars,0.0,0);// final cuttinglasthigh=-1; lasthighpos=-1;lastlow=-1; lastlowpos=-1;for(shift=Bars; shift>=0; shift–){curlow=zzL[shift];curhigh=zzH[shift];if((curlow==0)&&(curhigh==0)) continue;//—if(curhigh!=0){if(lasthigh>0){if(lasthigh<curhigh) zzH[lasthighpos]=0;else zzH[shift]=0;}//—if(lasthigh<curhigh || lasthigh<0){lasthigh=curhigh;lasthighpos=shift;}lastlow=-1;}//—-if(curlow!=0){if(lastlow>0){if(lastlow>curlow) zzL[lastlowpos]=0;else zzL[shift]=0;}//—if((curlow<lastlow)||(lastlow<0)){lastlow=curlow;lastlowpos=shift;}lasthigh=-1;}}for(shift=Bars-1; shift>=0; shift–){zz[shift]=zzL[shift];res=zzH[shift];if(res!=0.0) zz[shift]=res;}}void GetHigh(int start, int end, double price, int step){int count=end-start;if (count<=0) return;int i=iHighest(NULL,0,MODE_HIGH,count+1,start);double val=High[i];if ((val-price)>(minSize*Point)){zzH[i]=val;if (i==start) {GetLow(start+step,end-step,val,1-step); if (zzL[start-1]>0) zzL[start]=0; return;}if (i==end) {GetLow(start+step,end-step,val,1-step); if (zzL[end+1]>0) zzL[end]=0; return;}GetLow(start,i-1,val,0);GetLow(i+1,end,val,0);}}void GetLow(int start, int end, double price, int step){int count=end-start;if (count<=0) return;int i=iLowest(NULL,0,MODE_LOW,count+1,start);double val=Low[i];if ((price-val)>(minSize*Point)){zzL[i]=val;if (i==start) {GetHigh(start+step,end-step,val,1-step); if (zzH[start-1]>0) zzH[start]=0; return;}if (i==end) {GetHigh(start+step,end-step,val,1-step); if (zzH[end+1]>0) zzH[end]=0; return;}GetHigh(start,i-1,val,0);GetHigh(i+1,end,val,0);}}//——————————————————–// ZigZag tauber. Êîíåö.//——————————————————–//—————————————————-// Ñâèíãè Ãàííà. Íà÷àëî.//—————————————————-void GannSwing(){int i,n;// Ïåðåìåííûå äëÿ Ñâèíãîâ Ãàííàdouble lLast_m=0, hLast_m=0;int countBarExt=0; // ñ÷åò÷èê âíåøíèõ áàðîâint countBarl=0,countBarh=0;fs=0; ti=0;// lLast, hLast – ìèíèìóì è ìàêñèìóì àêòèâíîãî áàðà// lLast_m, hLast_m – ìèíèìóì è ìàêñèìóì “ïðîìåæóòî÷íûõ” áàðîâArrayInitialize(zz,0.0);ArrayInitialize(zzL,0.0);ArrayInitialize(zzH,0.0);// cbi=Bars-IndicatorCounted()-1;//———————————cbi=Bars-1;for (i=cbi; i>=0; i–){//————————————————-// Óñòàíàâëèâàåì íà÷àëüíûå çíà÷åíèÿ ìèíèìóìà è ìàêñèìóìà áàðàif (lLast==0) {lLast=Low[i]; hLast=High[i]; ai=i; bi=i;}if (ti!=Time[i]){ti=Time[i];if (lLast_m==0 && hLast_m==0){if (lLast>Low[i] && hLast<High[i]) // Âíåøíèé áàð{lLast=Low[i];hLast=High[i];lLast_m=Low[i];hLast_m=High[i];countBarExt++;if (fs==1) {countBarl=countBarExt; ai=i; tai=Time[i];}else if (fs==2) {countBarh=countBarExt; bi=i; tbi=Time[i];}else {countBarl++;countBarh++;}}else if (lLast<=Low[i] && hLast<High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå âîñõîäÿùàÿ{lLast_m=0;hLast_m=High[i];countBarl=0;countBarExt=0;if (fs!=1) countBarh++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; ai=i; tai=Time[i];}}else if (lLast>Low[i] && hLast>=High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå íèñõîäÿùàÿ{lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0;if (fs!=2) countBarl++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];}}}else if (lLast_m>0 && hLast_m>0) // Âíåøíèé áàð (ïðåäûäóùèé){if (lLast_m>Low[i] && hLast_m<High[i]) // Âíåøíèé áàð{lLast=Low[i];hLast=High[i];lLast_m=Low[i];hLast_m=High[i];countBarExt++;if (fs==1) {countBarl=countBarExt; ai=i; tai=Time[i];}else if (fs==2) {countBarh=countBarExt; bi=i; tbi=Time[i];}else {countBarl++;countBarh++;}}else if (lLast_m<=Low[i] && hLast_m<High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå âîñõîäÿùàÿ{lLast_m=0;hLast_m=High[i];countBarl=0;countBarExt=0;if (fs!=1) countBarh++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; ai=i; tai=Time[i];}}else if (lLast_m>Low[i] && hLast_m>=High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå íèñõîäÿùàÿ{lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0;if (fs!=2) countBarl++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];}}}else if (lLast_m>0){if (lLast_m>Low[i] && hLast<High[i]) // Âíåøíèé áàð{lLast=Low[i];hLast=High[i];lLast_m=Low[i];hLast_m=High[i];countBarExt++;if (fs==1) {countBarl=countBarExt; ai=i; tai=Time[i];}else if (fs==2) {countBarh=countBarExt; bi=i; tbi=Time[i];}else {countBarl++;countBarh++;}}else if (lLast_m<=Low[i] && hLast<High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå âîñõîäÿùàÿ{lLast_m=0;hLast_m=High[i];countBarl=0;countBarExt=0;if (fs!=1) countBarh++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; ai=i; tai=Time[i];}}else if (lLast_m>Low[i] && hLast>=High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå íèñõîäÿùàÿ{lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0;if (fs!=2) countBarl++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];}}}else if (hLast_m>0){if (lLast>Low[i] && hLast_m<High[i]) // Âíåøíèé áàð{lLast=Low[i];hLast=High[i];lLast_m=Low[i];hLast_m=High[i];countBarExt++;if (fs==1) {countBarl=countBarExt; ai=i; tai=Time[i];}else if (fs==2) {countBarh=countBarExt; bi=i; tbi=Time[i];}else {countBarl++;countBarh++;}}else if (lLast<=Low[i] && hLast_m<High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå âîñõîäÿùàÿ{lLast_m=0;hLast_m=High[i];countBarl=0;countBarExt=0;if (fs!=1) countBarh++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; ai=i; tai=Time[i];}}else if (lLast>Low[i] && hLast_m>=High[i]) // Òåíäåíöèÿ íà òåêóùåì áàðå íèñõîäÿùàÿ{lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0;if (fs!=2) countBarl++;else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];}}}// Îïðåäåëÿåì íàïðàâëåíèå òðåíäà.if (fs==0){if (lLast<lLast_m && hLast>hLast_m) // âíóòðåííèé áàð{lLast=Low[i]; hLast=High[i]; ai=i; bi=i; countBarl=0;countBarh=0;countBarExt=0;}if (countBarh>countBarl && countBarh>countBarExt && countBarh>minBars){lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0;fs=1;countBarh=0;countBarl=0;countBarExt=0;zz[bi]=Low[bi];zzL[bi]=Low[bi];zzH[bi]=0;ai=i;tai=Time[i];}else if (countBarl>countBarh && countBarl>countBarExt && countBarl>minBars){lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0;fs=2;countBarl=0;countBarh=0;countBarExt=0;zz[ai]=High[ai];zzH[ai]=High[ai];zzL[ai]=0;bi=i;tbi=Time[i];}}else{if (lLast_m==0 && hLast_m==0){countBarl=0;countBarh=0;countBarExt=0;}// Òåíäåíöèÿ âîñõîäÿùàÿif (fs==1){if (countBarl>countBarh && countBarl>countBarExt && countBarl>minBars) // Îïðåäåëÿåì òî÷êó ñìåíû òåíäåíöèè.{// çàïîìèíàåì çíà÷åíèå íàïðàâëåíèÿ òðåíäà fs íà ïðåäûäóùåì áàðåai=iBarShift(Symbol(),Period(),tai);fs=2;countBarl=0;zz[ai]=High[ai];zzH[ai]=High[ai];zzL[ai]=0;bi=i;tbi=Time[i];lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0;for (n=0;countBarExt<minBars;n++){if (lLast<Low[i+n+1] && hLast>High[i+n+1]) {countBarExt++; countBarh++; lLast=Low[i+n+1]; hLast=High[i+n+1]; hLast_m=High[i];}else break;}lLast=Low[i]; hLast=High[i];}}// Òåíäåíöèÿ íèñõîäÿùàÿif (fs==2){if (countBarh>countBarl && countBarh>countBarExt && countBarh>minBars) // Îïðåäåëÿåì òî÷êó ñìåíû òåíäåíöèè.{// çàïîìèíàåì çíà÷åíèå íàïðàâëåíèÿ òðåíäà fs íà ïðåäûäóùåì áàðåbi=iBarShift(Symbol(),Period(),tbi);fs=1;countBarh=0;zz[bi]=Low[bi];zzL[bi]=Low[bi];zzH[bi]=0;ai=i;tai=Time[i];lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0;for (n=0;countBarExt<minBars;n++){if (lLast<Low[i+n+1] && hLast>High[i+n+1]) {countBarExt++; countBarl++; lLast=Low[i+n+1]; hLast=High[i+n+1]; lLast_m=Low[i];}else break;}lLast=Low[i]; hLast=High[i];}}}}if (i==0){if (hLast<High[i] && fs==1) // Òåíäåíöèÿ íà òåêóùåì áàðå âîñõîäÿùàÿ{ai=i; tai=Time[i]; zz[ai]=High[ai]; zzH[ai]=High[ai]; zzL[ai]=0;}else if (lLast>Low[i] && fs==2) // Òåíäåíöèÿ íà òåêóùåì áàðå íèñõîäÿùàÿ{bi=i; tbi=Time[i]; zz[bi]=Low[bi]; zzL[bi]=Low[bi]; zzH[bi]=0;}//===================================================================================================// Íóëåâîé áàð. Ðàñ÷åò ïåðâîãî ëó÷à ZigZag-aai0=iBarShift(Symbol(),Period(),tai);bi0=iBarShift(Symbol(),Period(),tbi);if (bi0>1) if (fs==1){for (n=bi0-1; n>=0; n–) {zzH[n]=0.0; zz[n]=0.0;}zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0.0;}if (ai0>1) if (fs==2){for (n=ai0-1; n>=0; n–) {zzL[n]=0.0; zz[n]=0.0;}zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0.0;}if (ti<Time[1]) i=2;}//====================================================================================================}//——————————————–}//——————————————————–// Ñâèíãè Ãàííà. Êîíåö.//——————————————————–//—————————————————-// nen-ZigZag. Ðåæèì DT. Íà÷àëî.//—————————————————-void nenZigZag(){if (cbi>0){datetime nen_time=iTime(NULL,GrossPeriod,0);int i=0, j=0; // j – íîìåð áàðà ñ ìàêñèìàëüíûì ìàêñèìóìîì (ìèíèìàëüíûì ìèíèìóìîì) â ïîëîñêå nen-ZigZagdouble nen_dt=0, last_j=0, last_nen=0; //last_j – çíà÷åíèå ìàêñèìàëüíîãî ìàêñèìóìà (ìèíèìàëüíîãî ìèíèìóìà) â ïîëîñêå nen_ZigZagint limit, big_limit, bigshift=0;int i_metka=-1, i_metka_m=-1, k, m, jm;bool fl_metka=false;double last_jm=0, last_nen_m=0;if (init_zz){limit=Bars-1;big_limit=iBars(NULL,GrossPeriod)-1;}else{limit=iBarShift(NULL,0,afr[2]);big_limit=iBarShift(NULL,GrossPeriod,afr[2]);}while (bigshift<big_limit && i<limit) // íà÷àëüíîå çàïîëíåíèå áóôåðà nen-ZigZag (“ïîëîñêè”){if (Time[i]>=nen_time){if (ExtIndicator==6){nen_ZigZag[i]=iCustom(NULL,GrossPeriod,”ZigZag_new_nen4″,minBars,ExtDeviation,ExtBackstep,0,0,bigshift);}else if (ExtIndicator==7){nen_ZigZag[i]=iCustom(NULL,GrossPeriod,”DT_ZZ_nen”,minBars,0,0,bigshift);}else if (ExtIndicator==8) nen_ZigZag[i]=iCustom(NULL,GrossPeriod,”CZigZag”,minBars,ExtDeviation,0,bigshift);else if (ExtIndicator==10){nen_ZigZag[i]=iCustom(NULL,GrossPeriod,”Swing_ZZ_1″,minBars,1,0,bigshift);}i++;}else {bigshift++;nen_time=iTime(NULL,GrossPeriod,bigshift);}}if (init_zz) // îáðàáîòêà èñòîðèè{double i1=0, i2=0;init_zz=false;for (i=limit;i>0;i–) // îïðåäåëåíèå íàïðàâëåíèÿ ïåðâîãî ëó÷à{if (nen_ZigZag[i]>0){if (i1==0) i1=nen_ZigZag[i];else if (i1>0 && i1!=nen_ZigZag[i]) i2=nen_ZigZag[i];if (i2>0){if (i1>i2) hi_nen=true;else hi_nen=false;break;}}}}else // ðåæèì ðåàëüíîãî âðåìåíè{if (afrl[2]>0) hi_nen=false; else hi_nen=true;}for (i=limit;i>=0;i–){// if (i<limit){zz[i]=0; zzH[i]=0; zzL[i]=0;}if (nen_ZigZag[i]>0){fl_metka=true;if (nen_dt>0 && nen_dt!=nen_ZigZag[i]){if (i_metka>=0 && fl_metka){m=i_metka-GrossPeriod/Period();for (k=i_metka; k>m; k–){ha[k]=0; la[k]=0;}if (hi_nen) ha[j]=last_nen;else la[j]=last_nen;i_metka=i;}if (hi_nen) {hi_nen=false;zzH[j]=last_nen;}else {hi_nen=true;zzL[j]=last_nen;}last_j=0;nen_dt=0;zz[j]=last_nen;}if (hi_nen){nen_dt=nen_ZigZag[i];if (last_j<High[i]) {j=i;last_j=High[i];last_nen=nen_ZigZag[i];}}else{nen_dt=nen_ZigZag[i];if (last_j==0) {j=i;last_j=Low[i];last_nen=nen_ZigZag[i];}if (last_j>Low[i]) {j=i;last_j=Low[i];last_nen=nen_ZigZag[i];}}if (nen_dt>0 && i==0) // îïðåäåëåíèå ïåðåëîìà íà íóëåâîì áàðå GrossPeriod{if (i_metka>=0 && fl_metka){m=i_metka-GrossPeriod/Period();for (k=i_metka; k>m; k–){ha[k]=0; la[k]=0;}if (hi_nen) ha[j]=last_nen;else la[j]=last_nen;fl_metka=false;}zz[j]=last_nen;if (hi_nen) zzH[j]=last_nen; else zzL[j]=last_nen;}}else{if (last_j>0 && fl_metka){if (i_metka>=0 && fl_metka){m=i_metka-GrossPeriod/Period();for (k=i_metka; k>m; k–){ha[k]=0; la[k]=0;}if (hi_nen) ha[j]=last_nen;else la[j]=last_nen;}fl_metka=false;if (hi_nen) {hi_nen=false;zzH[j]=last_nen;}else {hi_nen=true;zzL[j]=last_nen;}last_j=0;nen_dt=0;zz[j]=last_nen;i_metka=-1;}}}}}//——————————————————–// nen-ZigZag. Ðåæèì DT. Êîíåö.//——————————————————–/*——————————————————————+| ZigZag_Talex, èùåò òî÷êè ïåðåëîìà íà ãðàôèêå. Êîëè÷åñòâî òî÷åê || çàäàåòñÿ âíåøíèì ïàðàìåòðîì ExtPoint. |+——————————————————————*/void ZZTalex(int n){/*ïåðåìåííûå*/int i,j,k,zzbarlow,zzbarhigh,curbar,curbar1,curbar2,EP,Mbar[];double curpr,Mprice[];bool flag,fd;/*íà÷àëî*/// for(i=0;i<=Bars-1;i++)// {zz[i]=0.0;zzL[i]=0.0;zzH[i]=0.0;}ArrayInitialize(zz,0);ArrayInitialize(zzL,0);ArrayInitialize(zzH,0);EP=ExtPoint;zzbarlow=iLowest(NULL,0,MODE_LOW,n,0);zzbarhigh=iHighest(NULL,0,MODE_HIGH,n,0);if(zzbarlow<zzbarhigh) {curbar=zzbarlow; curpr=Low[zzbarlow];}if(zzbarlow>zzbarhigh) {curbar=zzbarhigh; curpr=High[zzbarhigh];}if(zzbarlow==zzbarhigh){curbar=zzbarlow;curpr=funk1(zzbarlow, n);}ArrayResize(Mbar,ExtPoint);ArrayResize(Mprice,ExtPoint);j=0;endpr=curpr;endbar=curbar;Mbar[j]=curbar;Mprice[j]=curpr;EP–;if(curpr==Low[curbar]) flag=true;else flag=false;fl=flag;i=curbar+1;while(EP>0){if(flag){while(i<=Bars-1){curbar1=iHighest(NULL,0,MODE_HIGH,n,i);curbar2=iHighest(NULL,0,MODE_HIGH,n,curbar1);if(curbar1==curbar2){curbar=curbar1;curpr=High[curbar];flag=false;i=curbar+1;j++;break;}else i=curbar2;}Mbar[j]=curbar;Mprice[j]=curpr;EP–;}if(EP==0) break;if(!flag){while(i<=Bars-1){curbar1=iLowest(NULL,0,MODE_LOW,n,i);curbar2=iLowest(NULL,0,MODE_LOW,n,curbar1);if(curbar1==curbar2){curbar=curbar1;curpr=Low[curbar];flag=true;i=curbar+1;j++;break;}else i=curbar2;}Mbar[j]=curbar;Mprice[j]=curpr;EP–;}}/* èñïðàâëåíèå âåðøèí */if(Mprice[0]==Low[Mbar[0]])fd=true; else fd=false;for(k=0;k<=ExtPoint-1;k++){if(k==0){if(fd==true){Mbar[k]=iLowest(NULL,0,MODE_LOW,Mbar[k+1]-Mbar[k],Mbar[k]);Mprice[k]=Low[Mbar[k]];endbar=minBars;}if(fd==false){Mbar[k]=iHighest(NULL,0,MODE_HIGH,Mbar[k+1]-Mbar[k],Mbar[k]);Mprice[k]=High[Mbar[k]];endbar=minBars;}}if(k<ExtPoint-2){if(fd==true){Mbar[k+1]=iHighest(NULL,0,MODE_HIGH,Mbar[k+2]-Mbar[k]-1,Mbar[k]+1);Mprice[k+1]=High[Mbar[k+1]];}if(fd==false){Mbar[k+1]=iLowest(NULL,0,MODE_LOW,Mbar[k+2]-Mbar[k]-1,Mbar[k]+1);Mprice[k+1]=Low[Mbar[k+1]];}}if(fd==true)fd=false;else fd=true;/* ïîñòðîéêà ZigZag’a */zz[Mbar[k]]=Mprice[k];//Print(“zz_”+k,”=”,zz[Mbar[k]]);if (k==0){if (Mprice[k]>Mprice[k+1]){zzH[Mbar[k]]=Mprice[k];}else{zzL[Mbar[k]]=Mprice[k];}}else{if (Mprice[k]>Mprice[k-1]){zzH[Mbar[k]]=Mprice[k];}else{zzL[Mbar[k]]=Mprice[k];}}}}//——————————————————————// ZigZag_Talex êîíåö//——————————————————————/*——————————————————————-+/ Ôóíöèÿ äëÿ ïîèñêà ó ïåðâîãî áàðà (åñëè îí âíåøíèé) êàêîé ýêñòðåìóì |/ áóäåì èñïîëüçîâàòü â êà÷åñòâå âåðøèíû. Äëÿ ZigZag_Talex. |/——————————————————————-*/double funk1(int zzbarlow, int ExtDepth){double pr;int fbarlow,fbarhigh;fbarlow=iLowest(NULL,0,MODE_LOW,ExtDepth,zzbarlow);fbarhigh=iHighest(NULL,0,MODE_HIGH,ExtDepth,zzbarlow);if(fbarlow>fbarhigh) pr=High[zzbarlow];if(fbarlow<fbarhigh) pr=Low[zzbarlow];if(fbarlow==fbarhigh){fbarlow=iLowest(NULL,0,MODE_LOW,2*ExtDepth,zzbarlow);fbarhigh=iHighest(NULL,0,MODE_HIGH,2*ExtDepth,zzbarlow);if(fbarlow>fbarhigh) pr=High[zzbarlow];if(fbarlow<fbarhigh) pr=Low[zzbarlow];if(fbarlow==fbarhigh){fbarlow=iLowest(NULL,0,MODE_LOW,3*ExtDepth,zzbarlow);fbarhigh=iHighest(NULL,0,MODE_HIGH,3*ExtDepth,zzbarlow);if(fbarlow>fbarhigh) pr=High[zzbarlow];if(fbarlow<fbarhigh) pr=Low[zzbarlow];}}return(pr);}//——————————————————–// Êîíåö. Äëÿ ZigZag_Talex.//——————————————————–//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°// SQZZ by tovaroved.lv. Íà÷àëî. °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°double div(double a, double b){if(MathAbs(b)*10000>MathAbs(a)) return(a*1.0/b); else return(0);}//=============================================================================================double ray_value(double B1, double P1, double B2, double P2, double AAA){return(P1+( AAA -B1)*div(P2-P1,B2-B1));}//=============================================================================================datetime bar2time(int b){int t,TFsec=Period()*60; if(b<0) t=Time[0]-(b)*TFsec; else if(b>(Bars-1)) t=Time[Bars-1]-(b-Bars+1)*TFsec; else t=Time[b]; return(t);}//=============================================================================================int time2bar(datetime t){int b,t0=Time[0],TFsec=Period()*60; if(t>t0) b=(t0-t)/TFsec; else if(t<Time[Bars-2]) b=(Bars-2)+(Time[Bars-2]-t)/TFsec; else b=iBarShift(0,0,t); return(b);}//=============================================================================================void ZigZag_SQZZ(bool zzFill=true){ static int act_time=0,H1=10000,L1=10000,H2=10000,H3=10000,H4=10000,L2=10000,L3=10000,L4=10000;static double H1p=-1,H2p=-1,H3p=-1, H4p=-1,L1p=10000,L2p=10000,L3p=10000,L4p=10000;int mnm=1,tb,sH,sL,sX, i, a, barz, b,c, ii, H,L;double val,x,Lp,Hp,k=0.; if(Bars<100) return; if(1==2)bar2time(0);barz=Bars-4;int bb=barz;if(minBars==0)minBars=minSize;if(minSize==0)minSize=minBars*3; tb=MathSqrt(minSize*minBars);mnm=tb;a=time2bar(act_time);b=barz;//Print(a,” “,b,” “,tb,” “,barz,” “,0);if(a>=0 && a<tb){ii=a;a–;L1+=a;H1+=a;L2+=a;H2+=a;L3+=a;H3+=a;if(!zzFill){for(i=barz; i>=a; i–) {zzH[i]=zzH[i-a];zzL[i]=zzL[i-a];}for(;i>=0;i–) {zzH[i]=0;zzL[i]=0;}}}else{ii=barz;H1=ii+1; L1=ii;H2=ii+3; L2=ii+2;L2p=Low[L2];H2p=High[H2];L1p=Low[L1];H1p=High[H1];H3=H2;H3p=H2p;L3=L2;L3p=L2p;}act_time=Time[1];for(c=0; ii>=0; c++, ii–){// if(c>tb) if(zzFill) zz[ii+mnm]=MathMax(zzL[ii+mnm],zzH[ii+mnm]);// if(c>tb) if(zzFill) zz[ii]=MathMax(zzL[ii],zzH[ii]);H=ii; L=ii;Hp=High[H];Lp=Low[L];//————————————————————————————-if(H2<L2){// õàé óæå åñòü ãîòîâûéif( Hp>=H1p ){H1=H;H1p=Hp;if( H1p>H2p ){zzH[H2]=0;H1=H;H1p=Hp;H2=H1;H2p=H1p;L1=H1;L1p=H1p;zzH[H2]=H2p;}}else if( Lp<=L1p ){L1=L;L1p=Lp;x=ray_value(L2,L2p,H2+(L2-H3)*0.5,H2p+(L2p-H3p)*0.5,L1);if( L1p<=L2p//òàêæå ðàáîòàåò L1p<=L2p*0.75+H2p*0.25 èëè ëþáûå äðóãèå óñëîâèÿ|| tb*tb*Point<(H2p-L1p)*(H2-L1)){ //ñäâèãàåì âñå LowL4=L3;L4p=L3p;L3=L2;L3p=L2p;L2=L1;L2p=L1p;H1=L1;H1p=L1p;zzL[L2]=L2p;}}}//————————————————————–if(L2<H2) {// ëîó óæå åñòü ãîòîâûéif( Lp<=L1p ){L1=L;L1p=Lp;if( L1p<=L2p ){zzL[L2]=0;L1=L;L1p=Lp;L2=L1;L2p=L1p;H1=L1;H1p=L1p;zzL[L2]=L2p;}}else if( Hp>=H1p ){H1=H;H1p=Hp;x=ray_value(H2,H2p,L2+0.5*(H2-L3),L2p+0.5*(H2p-L3p),H1);if( H1p>=H2p//ìîæíî è òàê: H1p>=H2p*0.75+L2p*0.25|| tb*tb*Point<(H1p-L2p)*(L2-H1)){ //ñäâèãàåì âñå HighH4=H3;H4p=H3p;H3=H2;H3p=H2p;H2=H1;H2p=H1p;L1=H1;L1p=H1p;zzH[H2]=H2p;}}}//——————————————————————————–}//forfor(ii=bb-1; ii>=0; ii–) zz[ii]=MathMax(zzL[ii],zzH[ii]);}//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°// SQZZ by tovaroved.lv. Êîíåö.04/27/2024 at 5:56 PM #231995Bonjour,
au cas où, si c’est juste pour visualiser mais sans injecter les valeurs obtenues dans un code plus large, sans programmation si ça peut aider il y a une version intégrée à PRT dans le menu “Objets” / “Fibonacci” / sélectionner “Fibonacci Timezone”
-
AuthorPosts
Find exclusive trading pro-tools on