determination de tendance avec canaux de donchian et loi de dow

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #150903 quote
    arrot
    Participant
    Junior

    bonjour,

    je me suis habitué à lire sur les graphiques les canaux de donchian.

    je voudrais réaliser un backest puis un trading automatique du test des plus hauts et des plus bas suivant la théorie de dow. ligne haute de donchian plus haute que la précédente. ligne basse de donchian plus haute que la précédente. Dans ce cas tendance croissante. a l’inverse tendance décroissante. si pas les deux c’est un range.

    A chacune de ces 3 phases je coderai des conditions LONG  d’achat et de vente et SHORT de vente et rachat

    pouvez vous me proposer le code de cette partie de détermination des tendances.

    merci

    #150917 quote
    Nicolas
    Keymaster
    Master

    Ci-dessous le code qui détermine la tendance selon la comparaison des valeurs du canal de Donchian haut et bas avec leurs précédentes valeurs. J’ai codé 3 variables: bullish, bearish et neutral que tu pourras utiliser dans ta stratégie de trading automatique. La période de calcul du canal de Donchian se modifie à la première ligne du code.

    period = 20
    
    hh = highest[period](high)
    ll = lowest[period](low)
    
    if hh<>hh[1] then 
     if hh>hh[1] then 
      up=1
     else
      up=-1
     endif
    endif 
    
    if ll<>ll[1] then 
     if ll>ll[1] then 
      dn=1
     else
      dn=-1
     endif 
    endif 
    
    bullish = up=1 and dn=1
    bearish = up=-1 and dn=-1
    neutral = not bullish and not bearish
    
    return bullish coloured(0,255,0) style(histogram), bearish coloured(255,0,0) style(histogram), neutral
    

    D’autres liens utiles sur détection théorie de Dow:

    https://www.prorealcode.com/topic/help-with-higher-high-lower-low-price-swing-indicator-and-segment-drawings/#post-80673

    https://www.prorealcode.com/topic/conversion-tradingview-to-prorealtime-higher-highs-and-lower-lows/

    Bodaris thanked this post
    donchian-dow-theory.png donchian-dow-theory.png
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

determination de tendance avec canaux de donchian et loi de dow


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
arrot @arrot Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
5 years, 3 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 11/18/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...