Bonsoir,
j’utilise cet indicateur “Trend Enveloppe” (ci-dessous). La question est la suivante : je l’utilise en timeframe 1H et j’aimerai avoir sur ce timeframe 1h ce même indicateur mais calculé sur un timeframe 4h. Est-ce possible ? Et si oui comment ?
merci d’avance pour votre aide.
//////////////////////////////// Trend Envelopppes
timePeriod=14
Deviation=0.1
price=customclose
dsma = WeightedAverage[timePeriod](price)
valuesHigh = (1 + deviation / 100) * dsma
valuesLow = (1 - deviation / 100) * dsma
inputs=price
if (inputs > valuesHigh)then
trend = 1
elsif (inputs < valuesLow) then
trend = -1
endif
if (trend > 0) then
alpha1 = 0
if ( valuesLow < valuesLow[1]) then
valuesLow = valuesLow[1]
endif
if trend[1]>0 then
outputs0 = valuesLow
outputs1 = valueshigh
alpha0 = 255
endif
else
alpha0=0
if (valuesHigh > valuesHigh[1]) then
valuesHigh = valuesHigh[1]
endif
if trend[1]<0 then
outputs1 = valuesHigh
outputs0 = valueslow
alpha1 = 255
endif
endif
return outputs0 coloured(65,105,225,alpha0) as "EnvelopUp", outputs1 coloured(255,0,0,alpha1) as "Envelopdn"
Grâce à l’instruction TIMEFRAME, il faut l’ajouter en tête de code:
//////////////////////////////// Trend Envelopppes
timeframe(4 hours,updateonclose)
timePeriod=14
Deviation=0.1
price=customclose
dsma = WeightedAverage[timePeriod](price)
valuesHigh = (1 + deviation / 100) * dsma
valuesLow = (1 - deviation / 100) * dsma
inputs=price
if (inputs > valuesHigh)then
trend = 1
elsif (inputs < valuesLow) then
trend = -1
endif
if (trend > 0) then
alpha1 = 0
if ( valuesLow < valuesLow[1]) then
valuesLow = valuesLow[1]
endif
if trend[1]>0 then
outputs0 = valuesLow
outputs1 = valueshigh
alpha0 = 255
endif
else
alpha0=0
if (valuesHigh > valuesHigh[1]) then
valuesHigh = valuesHigh[1]
endif
if trend[1]<0 then
outputs1 = valuesHigh
outputs0 = valueslow
alpha1 = 255
endif
endif
return outputs0 coloured(65,105,225,alpha0) as "EnvelopUp", outputs1 coloured(255,0,0,alpha1) as "Envelopdn"
Merci mais je ne sais pas si j’ai bien posé ma question : cela veut dire qu’en sélectionnant dans PRT l’unité de temps 1h et en ajoutant “timeframe (4 hours,updateonclose)” j’aurai cet indicateur calculé sur un timeframe 4 h. Donc il viendra donc superposer à celui calculé par le timeframe sélectionné qui est le 1 heure en le rajoutant comme un 2ème indicateur ?
Oui exactement. Il faudra bien entendu utiliser deux codes différents, deux indicateurs: le mien (UT 4-heures) et le tient (UT sélectionné).
Merci beaucoup car je suis assez fan de cet indicateur.