Bonjour,
Un ami qui utilise TradingView m’a parlé d’un indicateur :MACD Fake Filter
Il m’a envoyé le code (voir pièce jointe) mais je ne parviens pas à la convertir afin de l’utiliser dans ProRealTime.
Merci par avance pour votre aide.
Bonne journée
DD
Holà. Ici vous avez le code. C'est quelque chose de différent qui fait que le support du MACD est actualisé à chaque pas du MACD sur la ligne 0. Personnellement, cela me paraît plus intéressant.
//---------------------------------------------------------------------------------//
//PRC_MACD Fake Filter
//version = 0
//10.07.2024
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//---------------------------------------------------------------------------------//
//-----Inputs----------------------------------------------------------------------//
fastlength=12
slowlength=26
signalLength=9
src=close
smasource=1
smasignal=1
//---------------------------------------------------------------------------------//
//-----MACD------------------------------------------------------------------------//
fastema=average[fastlength,smasource](src)
slowema=average[slowlength,smasource](src)
mymacd=fastema-slowema
signal=average[signalLength,smasignal](mymacd)
histo=mymacd-signal
//---------------------------------------------------------------------------------//
//-----MACD average wave height calculation----------------------------------------//
if mymacd crosses over 0 then
activeWave=1
elsif mymacd crosses under 0 then
activeWave=-1
endif
if activeWave=1 then
cumDnBar=0
CumDnMACD=0
cumUpBar=cumUpBar+1
CumUpMACD=CumUpMACD+mymacd
PositiveAverageHeight=CumUpMACD/cumUpBar
NegativeAverageHeight=NegativeAverageHeight
endif
if activeWave=-1 then
cumDnBar=cumDnBar+1
CumDnMACD=CumDnMACD+mymacd
cumUpBar=0
CumUpMACD=0
PositiveAverageHeight=PositiveAverageHeight
NegativeAverageHeight=CumDnMACD/cumDnBar
endif
//---------------------------------------------------------------------------------//
BearishCrossunder = mymacd crosses under signal
BullishCrossover = mymacd crosses over signal
//---------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------//
crossUnderAboveAvg = BearishCrossunder and mymacd > PositiveAverageHeight
crossAboveBelowAvg = BullishCrossover and mymacd < NegativeAverageHeight
//---------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------//
if crossUnderAboveAvg then
drawarrowdown(barindex,signal)coloured("red")
elsif crossAboveBelowAvg then
drawarrowup(barindex,signal)coloured("lightgreen")
endif
//---------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------//
if histo > 0 then
if histo<histo[1] then
r=0
g=128
b=0
else
r=50
g=205
b=50
endif
else
if histo<histo[1] then
r=255
g=0
b=0
else
r=128
g=0
b=0
endif
endif
//---------------------------------------------------------------------------------//
return histo coloured(r,g,b)style(histogram),mymacd coloured("blue")style(line,2), signal coloured("orange")style(line,2), 0 as "zero" style(dottedline2)
WOW ! Tout fonctionne très bien !
En grand MERCI Ivan !
Bonne journée
DD