Express EL_Bullish_Breakout2 Vars input $StartTime(0,2359,0),$EndTime(0,2359,2359); input $SendEmail(0,1,0),$PlaySound(0,1,0),$MessageBox(0,1,0); input $Smooth(1,5,1); // importance des hauts et des bas input $Mini(3,30,4); // Dernier haut et dernier bas doivent etre détectés au-dessus de cette limite input $Maxi(5,60,19); // Longueur maxi de tracé input $Prolong(3,20,10); // Longueur maxi du tracé de la prolongation une fois détecté et tracé. // ET empeche nouveau tracé tant que >0. input $MaxHighInclination(0,500,500); // Pente maxi de la résistance input $MinHighInclination(0,500,0); input $EntryStrategy(0,2,1);//Détermine la stratégie d'entrée. //0=pas d'entrée, 1=Entrée si cassure en clôture , 2=Entrée en clôture si cassure en cours de bougie input $DifferEntry(0,5,0); // diffère l'entrée de x bougies par rapport au signal series Hautdansmini,Hautdansmaxi; //,Basdansmini,Basdansmaxi; Series HDMA; Numeric Haut; series x,y; //,xx,yy; Series CBI; Series H1,H2,H3,H4,H5,CBIH1,CBIH2,CBIH3,CBIH4,CBIH5; Series ZH; Series ZHtemp; //ZBtemp; series ZHsuite; //ZBsuite, Numeric aH,bH; //,aB,bB; Numeric Hlongueur; //,Blongueur; Numeric zz; Series TracerSuite; Series bHsuite; //,bBsuite; Numeric a; Numeric b; Numeric i,j; Series EntreeLong; //,Entreecourt; Numeric bHStop,ZHStop; //,ZBStop,bBStop; Calculation // Le programme s'exécute à la clôture de chaque barre et non à chaque tick if IsFirstBar() then begin CalculateAtEveryTick(false); end // Ici on optimise la charge processeur CBI= CurrentBarIndex(); if Isfinalbar() and isbarcompleted() then begin for j=1 to CurrentBarIndex() begin Hautdansmini[j]= Highest(h,$Mini); y[j]= (IndexOfHighest(h,$Mini)-CBI[j]); HDMA[j]= Highest(h,($Maxi - $Mini)); x[j]= (IndexOfHighest(h,$Mini)-CBI[j]); Hautdansmaxi[j]= HDMA[j+$Mini]; end end // fin optim haut=0; if $smooth=1 and isbarcompleted() then begin if ((hh[2])) or ( (h=h[2]) and (h[2]>h[3]) ) then haut=1; end else begin if ( ($Smooth=2) and (hh[4]) ) then haut=2; if ( ($Smooth=3) and (h=h[4]) and (h[3]>=h[5]) and (h[3]>=h[6]) ) then haut=3; end if ( haut>0 ) then begin H5=H4[1]; CBIH5=CBIH4[1]; H4=H3[1]; CBIH4=CBIH3[1]; H3=H2[1]; CBIH3=CBIH2[1]; H2=H1[1]; CBIH2=CBIH1[1]; H1=h[$smooth]; CBIH1=CBI[$smooth]; end else begin //sinon on garde les anciennes valeurs et distances H5=H5[1]; CBIH5=CBIH5[1]; H4=H4[1]; CBIH4=CBIH4[1]; H3=H3[1]; CBIH3=CBIH3[1]; H2=H2[1]; CBIH2=CBIH2[1]; H1=H1[1]; CBIH1=CBIH1[1]; end // si on vient de tracer un haut // on recherche si dernier haut dans la limite de mini et écarté de $mini du précédent if( (CBI-CBIH1 <($Mini*$Smooth)) and ( ((CBI-CBIH1)=$Smooth) ) and (CBI>$Mini*$Smooth) and (Tracersuite[1]=0) and (ZH[$Mini +1] =void) ) then begin //-----------Critères généraux d'environnement pour le tracé---------------------------- A // Si c'est un haut qui vient de se tracer if((CBI-CBIH1)=$Smooth) and (TracerSuite[1]=0) then begin // Si c'est un haut qui vient de se tracer //------------------------------------------------------- Ba a=1; // On met a à 1 pour préparer le test de validation de la droite de résistance. Il sera mis à 0 si une résistance est trouvée. if( (H2>=H1) and ((CBIH1-CBIH2)>=($Mini-$Smooth)) and ((CBIH1-CBIH2+$Smooth)<=$Maxi) ) then begin // calcul de tracé de ligne des hauts entre H2 et H1 si H2>H1 ----------- C bH=( (H2-H1) / (CBIH1-CBIH2) ); aH=H1; for i= 0 to (CBI-CBIH2+$Smooth) begin ZHtemp[i]=aH + bH*(i-$Smooth); // a + bx end // vérification qu'aucun haut ne dépasse a=0; for i= 0 to (CBI-CBIH2+$Smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) ) then begin a=1; end // validation ou invalidation de la droite If(a=1) then begin for i= 0 to (CBI-CBIH2+$Smooth) begin ZHtemp[i]=void; end end if (a=0) then begin Hlongueur= ((CBI-CBIH2+$Smooth)); //si c'est bon, on stocke la longueur du haut tracé. zz=1; end ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end // end de C else begin // si on a pas validé H2->H1 on voit si H3>H1 ------------------------------------------------------------- C if( (H3>=H1) and (a=1) and ((CBIH1-CBIH3)>($Mini-$smooth)) and ((CBIH1-CBIH3+$Smooth)<=$Maxi) ) then begin // si on a pas validé H2->H1 on voit si H3>H1 ---------------------D bH=( (H3-H1) / (CBIH1-CBIH3) ); aH=H1; for i= 0 to (CBI-CBIH3+$Smooth) begin ZHtemp[i]=aH + bH*(i-$Smooth); // a + bx end // vérification qu'aucun haut ne dépasse a=0; for i= 0 to (CBI-CBIH3+$Smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin a=1; end // validation ou invalidation de la droite If(a=1) then begin for i= 0 to (CBI-CBIH3+$Smooth) begin ZHtemp[i]=void; end end if (a=0) then begin Hlongueur= ((CBI-CBIH3+$smooth)); //si c'est bon, on stocke la longueur du haut tracé. zz=1; end ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end //------------------------------------------------- D else begin //si on n'a pas validé H3->H1 on voit H1->H4 ------------------------------------------------- D if( (H4>=H1) and (a=1) and ((CBIH1-CBIH4)>($Mini-$smooth)) and ((CBIH1-CBIH4+$smooth)<=$Maxi) ) then begin // si on a pas validé H3->H1 on voit si H4>H1 ---------------------E //H3=9240; bH=( (H4-H1) / (CBIH1-CBIH4) ); aH=H1; for i= 0 to (CBI-CBIH4+$smooth) begin ZHtemp[i]=aH + bH*(i-$smooth); // a + bx end // vérification qu'aucun haut ne dépasse a=0; for i= 0 to (CBI-CBIH4+$smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) ) then begin a=1; end // validation ou invalidation de la droite If(a=1) then begin for i= 0 to (CBI-CBIH4+$smooth) begin ZHtemp[i]=void; end end if (a=0) then begin Hlongueur= ((CBI-CBIH4+$smooth)); //si c'est bon, on stocke la longueur du haut tracé. zz=1; end ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end //------------------------------------------------- E else begin //si on n'a pas validé H4->H1 on voit H2->H3 --------E if( (H3>=H2) and (a=1) and ((CBI-CBIH3)>($Mini))and ((CBIH1-CBIH3+$smooth)<=$Maxi) ) then begin // si on a pas validé H4->H1 on voit si H3>H2 ---------------------F bH=( (H3-H2) / (CBIH2-CBIH3) ); aH=H2; for i= 0 to (CBI-CBIH3+$smooth) begin ZHtemp[i]=aH + bH*(i-$smooth); // a + bx end // vérification qu'aucun haut ne dépasse a=0; for i= 0 to (CBI-CBIH3+$smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin a=1; end // validation ou invalidation de la droite If(a=1) then begin for i= 0 to (CBI-CBIH3+$smooth) begin ZHtemp[i]=void; end end if (a=0) then begin Hlongueur= ((CBI-CBIH3+$smooth)); //si c'est bon, on stocke la longueur du haut tracé. zz=1; end ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end //------------------------------------------------- F else begin //si on n'a pas validé H2->H3 on voit H2->H4 -------F if( (H4>=H2) and (a=1) and ((CBI-CBIH4)>($Mini)) and ((CBIH1-CBIH4+$smooth)<=$Maxi) ) then begin // si on a pas validé H2->H3 on voit si H2>H4 ---------------------G bH=( (H4-H2) / (CBIH2-CBIH4) ); aH=H2; for i= 0 to (CBI-CBIH4+$smooth) begin ZHtemp[i]=aH + bH*(i-$smooth); // a + bx end // vérification qu'aucun haut ne dépasse a=0; for i= 0 to (CBI-CBIH4+$smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin a=1; end // validation ou invalidation de la droite If (a=1) then begin //si a=1 alors on efface les ZHtemp (invalide) for i= 0 to (CBI-CBIH4+$smooth) begin ZHtemp[i]=void; end end if (a=0) then begin Hlongueur= ((CBI-CBIH4+$smooth)); //si c'est bon, on stocke la longueur du haut tracé. zz=1; end ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end //------------------------------------------------- FIN G end //---------------------------------------------------------------- FIN F end //------------------------------------------------------------------ FIN E end //--------------------------------------------------------------------FIN D end if(zz=1) then begin // si un tracé a été stocké b=1; if( (H2>=H1) ) then begin // si H2>=H1 ----------- C2 bH=( (H2-H1) / (CBIH1-CBIH2) ); // mais t aH=H1; //-((CBIB1-CBIH1)*bH ); for i= 0 to (CBI-CBIH2+$smooth) // begin ZHtemp[i]=aH + bH*(i-$smooth); // a + bx end // vérification qu'aucun haut ne dépasse b=0; for i= 0 to (CBI-CBIH2+$smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin // ................................................BISEAU DESCENDANT : ICI ! b=1; end // validation ou invalidation de la droite If(b=1) then begin for i= 0 to (CBI-CBIH2+$smooth) begin ZHtemp[i]=void; end end if (b=0) then begin zz=zz+1; Hlongueur= (CBI-CBIH2+$smooth); ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end end //----------------------------------------------------------------------- if( (H3>=H1) and (b=1) and ((CBIH1-CBIH3)>=($Mini/3)) ) then begin // ---------- bH=( (H3-H1) / (CBIH1-CBIH3) ); aH=H1; //-((CBIB1-CBIH1)*bH ); for i= (0) to ((CBI-CBIH3)+$smooth) begin ZHtemp[i]=aH + bH*(i-$smooth); // a + bx end // vérification qu'aucun haut ne dépasse b=0; for i= 0 to (CBI-CBIH3+$smooth) begin if ( (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin b=1; end // validation ou invalidation de la droite If(b=1) then begin for i= 0 to (CBI-CBIH3+$smooth) begin ZHtemp[i]=void; end end if (b=0) then begin zz=zz+1; Hlongueur= (CBI-CBIH3+$smooth); ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end end if( (H4>=H1) and (b=1) and ((CBIH1-CBIH4)>=($Mini/2)) ) then begin // Si pas de ligne, on cherche entre H1 et H4 ---- E2 bH=( (H4-H1) / (CBIH1-CBIH4) ); aH=H1;//-((CBIB1-CBIH1)*bH ); for i= 0 to (CBI-CBIH4+$smooth) begin ZHtemp[i]=aH + bH*(i-$smooth); // a + bx end // vérification qu'aucun haut ne dépasse b=0; for i= 0 to (CBI-CBIH4+$smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin b=1; end // validation ou invalidation de la droite If(b=1) then begin for i= 0 to (CBI-CBIH4+$smooth) ZHtemp[i]=void; end end if (b=0) then begin zz=zz+1; Hlongueur= (CBI-CBIH4+$smooth); ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end end //-------------------------------------------------------------- if( (H3>=H2) and (b=1) ) then begin bH=( (H3-H2) / (CBIH2-CBIH3) ); //coefdir aH=H2; //-((CBIB1-CBIH2)*bH ); // ATTENTION : le niveau de prix doit etre ici LA DROITE CALCULEE A LA FIN for i= (0) to ((CBI-CBIH3)+$smooth) begin ZHtemp[i]=aH + bH*(i-$smooth); end // vérification qu'aucun haut ne dépasse b=0; for i= 0 to (CBI-CBIH3+$smooth) begin if (ZHtemp[i]=$MaxHighInclination) or (((bH*100000)/c)<$MinHighInclination) ) then begin b=1; end // validation ou invalidation de la droite If(b=1) then begin for i= 0 to (CBI-CBIH3+$smooth) begin ZHtemp[i]=void; end end if (b=0) then begin zz=zz+1; Hlongueur= (CBI-CBIH3+$smooth); ZHtemp=void; // remise à "rien" de ZHtemp après traçage sur les barres précédentes. end end //---------------------------------------------------------------- If (zz=2) then begin For i= 0 to Hlongueur begin ZH[i]=ZHtemp[i]; end TracerSuite[1]=$Prolong+1; bHSuite=bH; end end end end else begin end // if (TracerSuite[1]<($Prolong+1)) and (TracerSuite[1]>0) then begin bHSuite=bHsuite[1]; ZHsuite=ZHsuite[1]-bHsuite; TracerSuite=TracerSuite[1]-1; end If TracerSuite[1]=($Prolong+1) then begin ZHsuite=ZH[1]-bHSuite; bHSuite=bH; TracerSuite=TracerSuite[1]-1; bHStop=bH; ZHStop=ZHsuite; // if $Sound=1 then PlaySound("E-BiseauEnFormation"); end if (Tracersuite=0) then begin ZHsuite=void; end if ($EntryStrategy=1) then begin if (c>ZHsuite) and ((c[1]<=ZHsuite[1]) or ( (ZHsuite[1]=void) and (ZHsuite<>void) ) ) and ( ((bHsuite*100000)/c)<=$MaxHighInclination) then begin // EntreeLong=1; end end if ($EntryStrategy=2) then begin if (h>ZHsuite) and ((h[1]<=ZHsuite[1]) or ( (ZHsuite[1]=void) and (ZHsuite<>void) ) ) and ( ((bHsuite*100000)/c)<=$MaxHighInclination) then begin EntreeLong=1; end end zz=0; ZH=void; Interpretation begin if (TimeToNumeric(timeopen) >= $StartTime) and (TimeToNumeric(timeopen) <= $EndTime) then begin if ((EntreeLong[$DifferEntry]=1) and (IsBarCompleted())) then begin sentiment = 100; if ($SendEmail = 1) then SendEmail("Buy signal","Buy signal: " + SymbolName()); if ($PlaySound = 1) then Playsound("ring"); if ($MessageBox = 1) then MessageBox("Buy signal: " + SymbolName()); end end end plot (ZH,black,3); plot (ZHsuite,green,2); //plot (H3,black,1); //plot (H1,green,1);//@@@cs:6747875-6762255-5883016_cs@@@