Bonjour,
Serait-il possible de convertir ce code Tradingview on formule PRT ?
Il s’agit d’une version modifiée des Weis Wave ; la version initiale existe dans la librairie PRT mais est assez différente de celle-ci.
Voici le code, ci-dessous – merci d’avance, Nicolas.
Pour la clarté, voici le lien de la page tradingview, où l’auteur donne le code, explique sa démarche, et explique comment appliquer le code:
https://www.tradingview.com/script/rksN65xY-My-Wave/
Carl
//@version=3
study(“My Wave”,overlay=true)
percent1 = input(title=”Percent, 1 = 1%”, defval=0.5, minval=0.001, maxval=20, step=0.001,type=float )
percent=percent1*0.01
weisup=volume
weisdown=volume
hh=0.00 //Highest High
hh:=nz(hh[1])
hhh=0.000
hhh:=nz(hhh[1])
ll=0.00 //Lowest Low
ll:=nz(ll[1])
lll=0.000
lll:=nz(lll[1])
count=0
count:=nz(count[1])+1
trend=0
trend:=nz(trend[1])
minimo=close //low
maximo=close //high
support=0.000
support2=0.000
support3=0.000
support4=0.000
resistance=0.000
resistance2=0.000
resistance3=0.000
resistance4=0.000
if barstate.isfirst
count:=0
ll := minimo //Lowest low
hh := maximo //Highest high
lll := low //Lowest low low
hhh := high //Highest high high
if count==1
if maximo >= hh[1]
hh := maximo
hhh := high
trend:= 1 //up
else
ll:= minimo
lll:=low
trend:= -1 //down
if count>1
if trend[1] > 0 //if trend up
hhh:=max(hhh[1],high)
if maximo >= hh[1] //if High greater or equal to Highest high
hh:= maximo
else //else (High is smaller than Highest high)
if minimo < hh[1] - hh[1] * percent //if low < Highest high - Highest high * Percent
ll:= minimo //Lowest low = low
lll:=low
trend:= -1 //trend down
else //else (trend down)
lll:=min(lll[1],low)
if minimo <= ll[1] //if Low smaller or equal to Lowest low
ll:= minimo //Lowest low = low
else //else (Low is greater than Lowest low)
if maximo > ll[1] + ll[1] * percent //if high > Lowest low + Lowest low * Percent
hh:= maximo //Highest high = high
hhh:=high
trend := 1 //trend up
ct=trend>trend[1]?1:trendll[1]) ?nz(weisup[1])+volume:na
weisdown:=trend==-1 or (trend[1]==1 and maximo