Elder Auto Envelopes
Forums › ProRealTime English forum › ProBuilder support › Elder Auto Envelopes
- This topic has 2 replies, 2 voices, and was last updated 1 month ago by Demon.
-
-
05/10/2021 at 8:07 AM #169225
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
Elder Auto envelope1234567a=exponentialAverage[22](Close)// We define the standard deviation.StdDeviation = STD[100](Close)Bsup = a + 2.7 * StdDeviationBinf = a - 2.7 * StdDeviationreturn A as "average", Bsup as "upperband", Binf as "lowerband"05/10/2021 at 8:41 AM #169228Heres some metastock code i found in case my explanation above was poor.
Best regards
123456789101112131415161718MetaStock FORMULAEMA:=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()<span class="prism-token prism-tag"><span class="prism-token prism-punctuation"><</span>Ref(DayOfWeek() <span class="prism-token prism-attr-name">,-1)</span> <span class="prism-token prism-attr-name">OR</span> <span class="prism-token prism-attr-name">(</span><span class="prism-token prism-attr-name">DayOfWeek()</span><span class="prism-token prism-attr-value"><span class="prism-token prism-punctuation">=</span>Ref(DayOfWeek(),-1)</span> <span class="prism-token prism-attr-name">AND</span> <span class="prism-token prism-attr-name">DayOfMonth()</span> <span class="prism-token prism-attr-name"><</span><span class="prism-token prism-punctuation">></span></span> 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;12/20/2024 at 9:31 AM #241605Hi,
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
FinSii=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%)
FinPourFinSi
-
AuthorPosts
Find exclusive trading pro-tools on