Ajout d’une donnée en timeframe 4h sur un timeframe 1H

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #182289 quote
    finplus
    Participant
    Master

    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"

     

    #182303 quote
    Nicolas
    Keymaster
    Master

    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"
    #182313 quote
    finplus
    Participant
    Master

    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 ?

    #182320 quote
    Nicolas
    Keymaster
    Master

    Oui exactement. Il faudra bien entendu utiliser deux codes différents, deux indicateurs: le mien (UT 4-heures) et le tient (UT sélectionné).

    #182323 quote
    finplus
    Participant
    Master

    Merci beaucoup car je suis assez fan de cet indicateur.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Ajout d’une donnée en timeframe 4h sur un timeframe 1H


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by finplus
4 years, 3 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 11/25/2021
Status: Active
Attachments: No files
Logo Logo
Loading...