Annonce
Réduire
Aucune annonce.
Ads
Réduire
Bibliothèque de Codes PRT
Réduire
X
 
  • Filtre
  • Heure
  • Afficher
Tout nettoyer
nouveaux messages

  • Bibliothèque de Codes PRT

    Bonjour,

    j'ai remarqué qu'il y a plein de codes PRT (indic, backtests, etc...) qui se promènent dans différentes files.

    Je vous propose de les mettre en commun dans cette file qu'Alain pourrait peut-être épingler si elle rencontre du succès.

    Pour commencer, comme c'est très demandé en ce moment, le code de la Volat avec +haut et +bas "historique", les canaux de Keltner et mon code de squeeze Carter (à mettre en histogramme).

    Ajout: Volat OBV

    Nom: Volat AD
    Variables: period (150 par défaut=définit la profondeur historique)


    //Calcul de la volatilité
    //et des valeurs minimale et maximale de celle-ci sur (period) périodes

    IF BarIndex<20 then
    VNK = Undefined
    else


    VNK=BollingerBandWidth[20](close)*4
    LimitMini=Lowest[period](VNK)
    LimitMaxi=Highest[period](VNK)
    Endif

    Return VNK COLOURED(255,50,10) as "VNK",LimitMaxi COLOURED(0,200,20) as "Limite Maxi",LimitMini COLOURED(0,20,200) as "Limite Mini"

    Nom: Canaux de Keltner

    Var: N (periode = 20)
    coeff (1.5)


    //Canaux de Keltner

    REM Moving Average
    MA = Average[N](TypicalPrice)

    REM Upper Keltner Band

    UpperBand = MA + coeff*Average[N](Range)

    REM Lower Keltner Band

    LowerBand = MA - coeff*Average[N](Range)

    RETURN MA AS "Keltner Moving Average" , UpperBand AS "Upper Keltner Band" , LowerBand as "Lower Keltner Band"


    Nom: Squeeze Carter

    Var: aucune

    Rem le Squeeze à la Carter
    // a mettre en histo et en tout petit (produit des petites barres en cas de squeeze)

    myKeltnerMovingAverage, myUpperKeltnerBand, myLowerKeltnerBand = CALL "Canaux de Keltner"[20 ,1.5]

    c1 = (myUpperKeltnerBand >= BollingerUp[20](close))
    c2 = (myLowerKeltnerBand <= BollingerDown[20](close))
    myKeltnerMovingAverage = myKeltnerMovingAverage +1
    if c1 and c2 then
    indic = 1
    else
    indic = 0
    endif

    return indic


    Nom: Volat OBV
    Var: period (=40)

    //Calcul de la volatilité OBVD
    //et des valeurs minimale et maximale de celle-ci sur (period) périodes (def = 40, je le trouve plus réaliste avec 40...)

    IF BarIndex<20 then
    VNK = Undefined
    else

    VNK=STD[20](OBV(typicalprice))
    LimitMini=Lowest[period](VNK)
    LimitMaxi=Highest[period](VNK)

    Endif

    Return VNK as "VNK",LimitMaxi COLOURED(0,200,20) as "Limite Maxi",LimitMini COLOURED(0,20,200) as "Limite Mini"

  • #2
    BONJOUR MIKE

    voila ce que j'obtiens avevc ta programmation.
    Je pense qu'il manque qq chose

    Commentaire


    • #3
      Si tu préfères la version avec l'ET, c'est celle-là.

      A priori, il ne manque rien, vérifie sur ton graph de prix, les périodes où la volat est historiquement basse correspondent bien à des squeeze (contraction des BB). Mais bon, s'il y a une erreur, les corrections seront les bienvenues.

      //Calcul de la volatilité
      //et des valeurs minimale et maximale de celle-ci sur 150 périodes

      IF BarIndex<20 then
      VNK = Undefined
      else
      VNK = STD[20](close)
      LimitMini=Lowest[period](VNK)
      LimitMaxi=Highest[period](VNK)
      Endif

      Return VNK COLOURED(255,50,10) as "VNK",LimitMaxi COLOURED(0,200,20) as "Limite Maxi",LimitMini COLOURED(0,20,200) as "Limite Mini"

      Commentaire


      • #4
        belle initiative
        bon courage

        Commentaire


        • #5
          2 nouveaux codes dont 1 en alternative à Volat OBV


          OBVD ((c)JL )

          Variables


          coeff (1.68)
          period (20)


          Rem OBVD JL

          if barindex < period then
          ob = 0
          else
          ob = OBV(TotalPrice)
          endif

          a = average[period](ob)

          st = std[period](ob)

          bsup = a + coeff*st
          binf = a- coeff*st

          return ob as "OBV", bsup as "Bsup", binf as "Binf", a as "Average"



          Volat OBVD


          variable
          period (150)

          //Calcul de la volatilité OBVD
          //et des valeurs minimale et maximale de celle-ci sur (period) périodes (def = 150)

          IF BarIndex<20 then
          VNK = Undefined
          else
          myOBV, myBsup, myBinf, myAverage = CALL OBVD[1.68 ,20]

          VNK=(myBsup-myBinf)/myAverage
          LimitMini=Lowest[period](VNK)
          LimitMaxi=Highest[period](VNK)
          myOBV = myOBV+1
          Endif

          Return VNK as "VNK",LimitMaxi COLOURED(0,200,20) as "Limite Maxi",LimitMini COLOURED(0,20,200) as "Limite Mini"

          Commentaire


          • #6
            MIKE-e

            Le code que tu as mis ci-dessous correspond t-il bien à l'indicateur de JL sous le nom de ET OBVD ??
            Volat OBVD

            variable
            period (150)

            //Calcul de la volatilité OBVD
            //et des valeurs minimale et maximale de celle-ci sur (period) périodes (def = 150)

            IF BarIndex<20 then
            VNK = Undefined
            else
            myOBV, myBsup, myBinf, myAverage = CALL OBVD[1.68 ,20]

            VNK=(myBsup-myBinf)/myAverage
            LimitMini=Lowest[period](VNK)
            LimitMaxi=Highest[period](VNK)
            myOBV = myOBV+1
            Endif

            Return VNK as "VNK",LimitMaxi COLOURED(0,200,20) as "Limite Maxi",LimitMini COLOURED(0,20,200) as "Limite Mini"

            D'avance merci

            Commentaire


            • #7
              @ lafrite

              c'est ma version du code. Tu peux aussi prendre celle du premier post qui correspond à celle de JL (std). Si ce n'est que je ne suis gourrré de prix, j'ai mis le typicalprice au lieu du totalprice. A corriger (mais je n'ai plus accès à l'édition de mon post, il doit y avoir une limite temporelle... ).


              Pour l'OBVD, le paramétrage est dans l'indic que j'ai donné (boll: 20 1.68, OBV sur totalprice=o+c+h+l/4).

              Pour la MACD ZL, un code que j'ai récupéré (je crois que c'est JL qui l'avait donné sur la file de Crock).


              // MACD ZERO LAG

              // p= variable macd zerolag
              // q= variable signal
              // r= variable macd - Mais virer le signal histogramme (invisible sur PRT)

              z1=DEMA[p](close)


              z2 =dema[q](close)

              e= z1 - z2



              z3=DEMA[r](e)

              f=z3

              g=e-f

              return e AS "MACD ZEROLAG",f AS "signal",g as "macd-signal",0 as "zero"


              Commentaire


              • #8
                Mille merci monsieur mike-e

                Commentaire


                • #9
                  Bonjour,

                  Très bonne initiative, je contribue :

                  Extreme Jour :

                  Petit code tout bête mais très utile sur les vues intraday.
                  Il affiche les + hauts + bas du jour X choisir sur le graphique du jour. Indicateur a utiliser directement sur le prix.
                  Remplacez ext par une variable pour plus de flexibilité. la variable représente le jour pour lequel vous voulez afficher les + hauts + bas.
                  //Début du code
                  ext=1
                  return DHigh(ext) as "Plus Haut",DLow(ext) as "Plus bas"
                  //fin du code



                  Smoothed ROC :

                  //pour ceux qui souhaitent modifier dynamiquement les variables X et Y, supprimez les deux premières lignes du code et intégrez les dans l'interface les variables sous PRT. X est la Période MM, Y est la Période ROC
                  //début du code
                  X = 13
                  y = 20
                  ema = ExponentialAverage[x](close)
                  sroc = ROC[y](ema)

                  return sroc
                  //fin du code


                  Chandelier STOP
                  //début du code
                  OscAtr3 = averagetruerange[10](close)*3.5
                  OscAtr25 = averagetruerange[10](close)*2.5

                  PREV = Chandelier[1]

                  if PREV < Low THEN
                  if (High - OscAtr3) >= PREV then
                  Stop1 = High - OscAtr3
                  else
                  Stop1 = PREV
                  endif
                  else
                  Stop1 = High - OscAtr3
                  endif

                  if PREV < low then
                  if (Close - OscAtr25) >= PREV then
                  Stop2 = Close - OscAtr25
                  else
                  Stop2 = prev
                  endif
                  else
                  Stop2 = Close - OscAtr25
                  endif


                  If Stop1 > Stop2 then
                  StopLong = Stop1
                  else
                  StopLong = Stop2
                  endif


                  if PREV > High then
                  if (Low + OscAtr3) <= PREV then
                  Stop1 = Low + OscAtr3
                  else
                  Stop1 = PREV
                  endif
                  else
                  Stop1 = Low + OscAtr3
                  endif


                  if (PREV > High) then
                  if (Close + OscAtr25) <= PREV then
                  Stop2 = Close + OscAtr25
                  else
                  Stop2 = PREV
                  endif
                  else
                  Stop2 = Close + OscAtr25
                  endif


                  If Stop1 < Stop2 then
                  StopShort = Stop1
                  else
                  StopShort = Stop2
                  endif

                  If Low > stoplong[1] then
                  GLow=Glow+1
                  else
                  Glow=0
                  endif

                  If High < Stopshort[1] then
                  Ghigh=Ghigh+1
                  else
                  Ghigh=0
                  endif


                  if Glow > Ghigh then
                  Chandelier = StopLong
                  else
                  Chandelier = StopShort
                  endif

                  if close > chandelier then
                  col=1
                  else
                  col=-1
                  endif

                  Return Chandelier coloured by col
                  //fin du code

                  Commentaire


                  • #10
                    Merci aux contributeurs!

                    Essayez de mettre l'utilité/utilisation des indic s'ils ne sont pas évidents. Ton chandelier stop dessine une ligne de stop en fonction de la volat récente (atr) d'après ce que j'ai pu voir. Ca ressemble un peu à une ST.

                    Voici un indic très simple mais utile pour ceux qui n'ont pas de connaissance en programmation, les pivots Carter complets (avec demi-pivots et open jour, close veille).


                    REM Points Pivots Carter


                    P = (DHIGH(1) + DLOW(1) + DCLOSE(1)) / 3




                    // Résistance 3 : R3 = R2 + (Hveille - Bveille)
                    PR3 = PR1 + (DHIGH(1) - DLOW(1))

                    MidPr3 = (PR2+PR3) / 2

                    // Résistance 2 : R2 = P + (Hveille - Bveille)
                    PR2 = P + (DHIGH(1) - DLOW(1))

                    MidPr2 = (PR2+PR1) / 2

                    // Résistance 1 : R1 = 2 * P - Bveille
                    PR1 = 2 * P - DLOW(1)

                    MidPr1 = (P+PR1) / 2

                    // Support 1 : S1 = 2 * P - Hveille
                    PS1 = 2 * P - DHIGH(1)

                    MidPs1 = (P+PS1) / 2

                    // Support 2 : S2 = P - (Hveille - Bveille)
                    PS2 = P - (DHIGH(1) - DLOW(1))

                    MidPs2 = (PS2+PS1) / 2

                    // Support 3 : S3 = S2 - (Hveille - Bveille)
                    PS3 = PS1 - (DHIGH(1) - DLOW(1))

                    MidPs3 = (PS3+PS2) / 2


                    RETURN PR3 COLOURED(0,0,255) AS "Res3" , MidPr3 COLOURED(0,0,88) AS "MidPr2-3" , PR2 COLOURED(0,0,255) AS "Res2" , MidPr2 COLOURED(0,0,88) AS "MidPr1-2" , PR1 COLOURED(0,0,255) AS "Res1" , MidPr1 COLOURED(0,0,88) AS "MidPr P-1" , P COLOURED(255,20,25) AS "Pivot" , MidPs1 COLOURED(0,0,88) AS "MidPP-Ps1" , PS1 COLOURED(0,0,255) AS "Sup1" , MidPs2 COLOURED(0,0,88) AS "MidPs1-Ps2" , PS2 COLOURED(0,0,255) AS "Sup2" , MidPs3 COLOURED(0,0,88) AS "MidPs2-Ps3" , PS3 COLOURED(0,0,255) AS "Sup3" , DOPEN(0) COLOURED(55,155,155) AS "Open Jour" , DCLOSE(1) COLOURED(55,55,155) AS "Cloture Veille"



                    Dans le même esprit que le Chandelier stop au dessus, une enveloppe de stop pour s'éloigner du bruit du marché avec la méthode d'E Lefort (voir son webinaire sur les stops). A mettre de préférence sur les prix). Deux variantes de positionnement sont proposées (dont l'une en remarque à activer selon son appréciation)


                    Stop EL

                    Variables
                    periode (5)
                    mult (1.52 decimal)

                    Rem Stop façon EL

                    h = summation[periode](range)
                    h = (h*mult) / periode

                    rem avec le prix median
                    rem stshort = MedianPrice+h
                    rem stlong = MedianPrice-h

                    rem avec le prix extreme
                    stshort = high+h
                    stlong = low-h

                    return stshort coloured(200,50,30) as "Stshort", stlong coloured(50,50,200) as "Stlong"





                    Commentaire


                    • #11
                      merci Mike-e ,il m'arrive de trader en suivant le sens des bandes de Keltner,as tu des parametres pour les colorer(h et b)?

                      Commentaire


                      • #12
                        Tout d'abord je trouve que l'ouverture de cette file pour centraliser les programme PRT est une excellente initiative. Je tente de trouver un code similaire à celui de ProReal Trend afin de pouvoir visualiser (sur diverses UT) les 3 figures graphiques majeurs canaux, triangle, diamants en ID weekly monthly....mais là j'avoue que je galère....quelqu'un serait t il en mesure de m'aider ou de créer un tel programme ?

                        Commentaire


                        • #13
                          Personne ne saurait programmer pro realtrend ?

                          Commentaire


                          • #14
                            bonjour, je souhaiterai traduire un code GRAPHE AT quelqu'un peut il m'aider .D'avance merci

                            voici le code

                            //===============
                            //SUPER_TREND_CCI
                            //===============

                            //smallcaps90 le 3/7/2006


                            //CCI20
                            //
                            MO=MOYENNE((HAUT+BAS+CLOTURE)/3,P2)
                            DEVIA=MOYENNE(ABSOLU(HAUT+BAS+CLOTURE)/3-MO,P2)
                            CCI20(0)=(HAUT+BAS+CLOTURE)/3-MO

                            //ATR5
                            //
                            TR5(0)=MAXVAL(HAUT,CLOTURE(1))-MINVAL(BAS,CLOTURE(1))
                            ATR5=MOYENNE(TR5,P3)

                            //Règles
                            //
                            CCI_ACTU=CCI20(0)
                            CCI_PRECED=CCI20(1)

                            SI CCI_ACTU>=P1 ET CCI_PRECED
                            SI CCI_ACTU<=P1 ET CCI_PRECED>P1 ALORS TR_DN(1)=TR_UP(1)

                            SI CCI_ACTU>=P1
                            ALORS
                            TR_UP=BAS-ATR5
                            SI TR_UP FINSI

                            SI CCI_ACTU<=P1
                            ALORS
                            TR_DN=HAUT+ATR5
                            SI TR_DN>TR_DN(1) ALORS TR_DN=TR_DN(1)
                            FINSI

                            //Fin du Code

                            Commentaire


                            • #15
                              Bonjour,

                              Voici le code de l'indicateur TAKBIR (signal achat et vente) sur Metaquotes...

                              Ce systéme me semble plus qu'intéresant.......

                              Ya t'il un bon programmer pour nous le traduire en PRT ???


                              Merci par avance





                              //+------------------------------------------------------------------+
                              //| |
                              //| Copyright © 1999-2008, MetaQuotes Software Corp. |
                              //| http://www.metaquotes.ru |
                              //+------------------------------------------------------------------+
                              #property copyright "© 2007 Takbir"
                              #property link "www.stigal.com"
                              //----
                              #define major 1
                              #define minor 1
                              //----
                              #property indicator_chart_window
                              #property indicator_buffers 2
                              #property indicator_color1 Blue
                              #property indicator_color2 Red
                              #property indicator_width1 1
                              #property indicator_width2 1
                              //----
                              double UpperFr[];
                              double LowerFr[];
                              //----
                              int Bars.left=5;
                              int Bars.right=5;
                              //+------------------------------------------------------------------+
                              //| |
                              //+------------------------------------------------------------------+
                              void init()
                              {
                              SetIndexBuffer(0, UpperFr);
                              SetIndexBuffer(1, LowerFr);
                              //
                              SetIndexEmptyValue(0, 0);
                              SetIndexEmptyValue(1, 0);
                              //
                              SetIndexStyle(0, DRAW_ARROW);
                              SetIndexArrow(0, 217);
                              //
                              SetIndexStyle(1, DRAW_ARROW);
                              SetIndexArrow(1, 218);
                              }
                              //+------------------------------------------------------------------+
                              //| |
                              //+------------------------------------------------------------------+
                              void start()
                              {
                              int counted=IndicatorCounted();
                              if (counted < 0) return(-1);
                              if (counted > 0) counted--;
                              int limit=Bars-counted;
                              //-----
                              double dy=0;
                              for(int i=1; i<=20; i++)
                              {
                              dy+=0.3*(High-Low)/20;
                              }
                              for(i=1+Bars.right; i<=limit+Bars.left; i++)
                              {
                              UpperFr=0;
                              LowerFr=0;
                              //----
                              if (IsUpperFr(i)) UpperFr=High + dy;
                              if (IsLowerFr(i)) LowerFr=Low - dy;
                              }
                              }
                              //+------------------------------------------------------------------+
                              //| |
                              //+------------------------------------------------------------------+
                              bool IsUpperFr(int bar)
                              {
                              for(int i=1; i<=Bars.left; i++)
                              {
                              if (bar+i>=Bars) return(false);

                              if (High[bar] < High[bar+i]) return(false);
                              }
                              for(i=1; i<=Bars.right; i++)
                              {
                              if (bar-i < 0) return(false);
                              if (High[bar] < High[bar-i]) return(false);
                              }
                              //----
                              return(true);
                              }
                              //+------------------------------------------------------------------+
                              //| |
                              //+------------------------------------------------------------------+
                              bool IsLowerFr(int bar)
                              {
                              for(int i=1; i<=Bars.left; i++)
                              {
                              if (bar+i>=Bars) return(false);
                              if (Low[bar] > Low[bar+i]) return(false);
                              }
                              for(i=1; i<=Bars.right; i++)
                              {
                              if (bar-i < 0) return(false);
                              if (Low[bar] > Low[bar-i]) return(false);
                              }
                              //----
                              return(true);
                              }
                              //+------------------------------------------------------------------+

                              Commentaire

                              Chargement...
                              X