Sans connaitre les equations a l'origine de la JMA difficile d'aller tres loin.
Par contre si tu veux ajouter de l'adaptivite a la JuSmoothedV1 de sohocool, tu peux te baser sur (http://sohocool.over-blog.com/article-moyenne-double-exponentielle-dema-multi-alphas-adaptative-119910002.html).
il calcule un coef fonction d'une volatilite calculee avec l'ecart type et pondere la periode de la moyenne par ce coef:
dev=STD[period_de_reference](prix)
avgstd=average[periode_de_reference](dev)
coef_volatilite=avg/dev
period=periode_de_reference * coef_volatilite // multiplie ou divise si tu veux augmenter ou diminuer la periode avec la volat
et tu utilises la variable period dans les calculs de la moyenne (ce n'est plus un entier mais pas genant pour la formulation utilisee):
Code : #
////MOVING AVERAGE "JURIK" SMOOTH
//BY SOHOCOOL AOUT 2013
///VARIABLE
///P= PERIODEREFERENCE //ENTIER
///PH = PHASE //ENTIER DEFAUT =1
////ALF = POWER // ENTIER DEFAUT =1
///////////////CHOIX DE 1 A 5
//OPT = OPTION //ENTIER 0= FILT 0
// 1= FILT 1
// DEFAUT 2= FILT2
prix=customclose
dev=std[p](prix)
avg=average[p](dev)
coefvolatilite=avg/dev
period=p*coefvolatilite
bet=(0.45*(Period-1)/(0.45*(Period-1)+2))
phase=ph
if alph=1 then
alpha = bet
elsif alph =2 then
alpha = bet*bet
elsif alph=3 then
alpha= bet*bet*bet
elsif alph =4 then
alpha =bet*bet*bet*bet
elsif alph =5 then
alpha= bet*bet*bet*bet*bet
else
alpha =bet
endif
If barindex >Period then
Filt0 = (1-alpha)*prix + alpha*Filt0[1]
Det0 = (prix - Filt0)*(1 - bet) + bet*Det0[1]
Filt1 = Filt0 + Phase*Det0
Det1 = (Filt1 - Filt2[1]) * ((1 - alpha)*(1-alpha)) + alpha*alpha*Det1[1]
Filt2 = Filt2[1] + Det1
endif
if Opt = 0 then
JSmooth = Filt0
elsif Opt = 1 then
JSmooth = Filt1
elsif Opt = 2 then
JSmooth = Filt2
else
jsmooth = filt2
endif
return jsmooth as " Jurik Smooth"