Elder Auto Envelopes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #169225 quote
    Alfy
    Participant
    Average

    Good morning guys, I’m looking to create the Alexander Elder auto envelopes. It doesn’t look like anyone on the forum has mentioned them before. The indicator shows a 22 day exponential moving average and then an envelope around said moving average which is calculated as the standard deviation of the price compared to that moving average over a lookback of 100days multiplied by 2.7 standard deviations. I’ve created some code but I’m having trouble on the bit calculating the standard deviation compared to the moving average if anyone can help?

    Best regards and thanks in advance

    a=exponentialAverage[22](Close)
    // We define the standard deviation.
    StdDeviation = STD[100](Close)
    Bsup = a + 2.7 * StdDeviation
    Binf = a - 2.7 * StdDeviation
    
    return A as "average", Bsup as "upperband", Binf as "lowerband"
    #169228 quote
    Alfy
    Participant
    Average

    Heres some metastock code i found in case my explanation above was poor.

    Best regards

     

    MetaStock FORMULA
    
    EMA:=Input("Base EMA",1,100,22);
    Factor:=Input("Factor",1,50,27);
    Avg:=Mov(C,EMA,E);
    csize:= StDev(2*Max(abs(H-Avg) ,abs(L-Avg)) / Avg,100)*Factor/10; 
    {Use 100 days for stable channel size - default is 2.7 std}
    Csize:= ValueWhen(1,
    DayOfWeek()<Ref(DayOfWeek() ,-1) OR (
    DayOfWeek()=Ref(DayOfWeek(),-1) AND DayOfMonth() <> Ref(DayOfMonth(),-1))
    ,Ref(csize,-1));
    { This pegs the StDev to last bar of week  AND only changes once per week}
    csize:=LastValue(csize);
    {fix to constant using last value}
    channel:=csize*Avg;
    Avg+channel/2;
    Avg-channel/2;
    Avg;
    #241605 quote
    Demon
    Participant
    Average

    Hi,

    I search also the same.

    I used this code create by smallcaps90 on a forum Graph At On Univers bourse site.

    Could somebody adapt it on PRT.

    Thanks

    For this code, I use

    P1 = 13

    P2 = 90

    P3 = 30

    //=============
    //CHANNEL_ELDER
    //=============

    //V1.0 PROTO
    //le 21/02/2009
    //smallcaps90
    //=============

    //Paramètres :
    //
    //P1=recul de calcul de la moyenne exponentielle
    //P2%=pourcentage de cours souhaités dans le channel
    //P3=nombre de périodes prises en compte
    //
    //====================================================
    //Ligne centrale du channel
    //
    Mid_Line=Exposuiv(Mid_Line,Cloture,P1)

    //Algorithme de recherche de la largeur du channel
    //
    Si RangHisto=FinHisto Alors

    //Boucle sur la largeur du channel
    //
    i=50
    TantQue i>=1 Faire
    Som_Up=0
    Som_Dn=0

    //Boucle sur les cours tests des nbs des dépassements
    //
    Pour P3 Cours
    Si Haut>Mid_Line*(1+i%) Alors Som_Up=Som_Up+1
    Si Bas<Mid_Line*(1-i%) Alors Som_Dn=Som_Dn+1
    FinPour

    //Vérification du nombre de hauts et de bas en dehors du channel
    //
    Si Som_Up>=(1-P2%)*P3 OU Som_Dn>=(1-P2%)*P3
    Alors
    Break
    FinSi

    i=i-0.1
    FinTantQue
    //Pour récupération par la statistique
    //
    ECART=i%
    NB_HAUTS_OUT=Som_Up
    NB_BAS_OUT=Som_Dn

    //Tracé du channel sur les cours
    //
    Pour 350 Cours
    Up_Line=Mid_Line*(1+i%)
    Dn_Line=Mid_Line*(1-i%)
    FinPour

    FinSi

    Elder-channel.png Elder-channel.png
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Elder Auto Envelopes


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alfy @alfy Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Demon
1 year, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/10/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...