Parabolique SAR, une version alternative (ATD)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #234606 quote
    Kobudera
    Participant
    New

    Bonjour,

    ci-dessous, une petite variation autour de Parabolique SAR: renversement quand les cours sont traversés et pas simplement touchés, et uniquement sur la barre suivante. Toute suggestion d’amélioration du code est la bienvenue.

    JCP

    PS: 2 paramètre à ajouter (increment: 0.02 et limite: 0.2)

    if barindex = 0 then
    tendance = 1
    facteur = increment
    extreme = low
    resultat = high
    elsif tendance[1] = 1 then
    extreme = max(extreme[1], high)
    if resultat[1] > low then
    tendance = -1
    facteur = increment
    resultat = max(extreme[1], max(high, high[1]))
    extreme = low
    else
    if extreme > extreme[1] and facteur < limite then
    facteur = facteur[1] + min(increment, limite - facteur)
    endif
    resultat = resultat[1] + facteur * (extreme - resultat[1])
    resultat = min(resultat, min(low, low[1]))
    endif
    else
    extreme = min(extreme[1], low)
    if resultat[1] < high then
    tendance = 1
    facteur  = increment
    resultat = min(extreme[1], min(low, low[1]))
    extreme  = high
    else
    if extreme < extreme[1] and facteur < limite then
    facteur = facteur[1] + min(increment,limite - facteur[1])
    endif
    
    resultat = resultat[1] + facteur * (extreme - resultat[1])
    resultat = max(resultat, max(high, high[ 1 ]))
    endif
    endif
    
    if barindex = 0 then
    r = resultat
    else
    r = resultat[1]
    endif
    
    if tendance[1] = 1 then
    
    cr = 0
    cg = 255
    cb = 0
    else
    cr = 255
    cg = 0
    cb = 0
    endif
    
    return r coloured(cr, cg, cb) style(point) as "ATD SAR"
    
    robertogozzi thanked this post
    #234626 quote
    Iván González
    Moderator
    Master

    Merci pour la contribution

    #235049 quote
    Kobudera
    Participant
    New

    Bonjour

    ci-dessous, une version plus “ATDMF” du parabolique SAR (en fait, c’est le SAR originel de J. Welles Wilder – issu de son livre “New concepts in technical trading system”). Les paramètes à déclarer sont:

    • initialValue: Décimal, 0.02
    • accelerationValue: décimal, 0.02
    • limitValue: décimal: 0.2

    Le code:

    once todayTrend = 1
    
    if barindex = 0 then
    
    factor = initialValue
    
    if todayTrend = 1 then
    todaySAR = low
    extremeValue = high
    else
    todaySAR = high
    extremeValue = low
    endif
    
    tomorrowSAR = todaySAR
    tomorrowTrend = todayTrend
    
    else
    
    todaySAR = tomorrowSAR
    todayTrend = tomorrowTrend
    
    if todayTrend = 1 then
    
    if extremeValue < high then
    extremeValue = high
    factor = min(limitValue, factor + accelerationValue)
    endif
    
    if todaySAR > low then
    tomorrowTrend = -1
    factor = initialValue
    tomorrowSAR = extremeValue
    extremeValue = low
    else
    tomorrowSAR = todaySAR + factor * (extremeValue - todaySAR)
    tomorrowSAR = min(tomorrowSAR, min(low, low[1]))
    endif
    
    else
    
    if extremeValue > low then
    extremeValue = low
    factor = min(limitValue, factor + accelerationValue)
    endif
    
    if todaySAR < high then
    tomorrowTrend = 1
    factor = initialValue
    tomorrowSAR = extremeValue
    extremeValue = high
    else
    tomorrowSAR = todaySAR + factor * (extremeValue - todaySAR)
    tomorrowSAR = max(tomorrowSAR, max(high, high[1]))
    endif
    
    endif
    
    endif
    
    colorRed = 0
    colorGreen = 0
    colorBlue = 0
    
    if todayTrend = 1 then
    colorGreen = 255
    else
    colorRed = 255
    endif
    
    return todaySAR coloured(colorRed, colorGreen, colorBlue) style(point) as "ATD SAR"
    

    La variable todayTrend, au début, permet de déterminer si on démarre “long” (todayTrend=1) ou “short” (todayTrend=-1). Pour information, les graphiques obtenus sur le CAC 40 sont (visuellement) identiques à ceux fournis pour étalonnage par Philippe Cahen dans son “Grand Livre Bleu” (Analyse Technique et Volatilité), pages 75 à 77 (attention, dans mon exemplaire du GLB, les graphiques hebdomadaire et quotidien sont inversés).

    Amicalement

    Nicolas and Iván González thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Parabolique SAR, une version alternative (ATD)


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Kobudera
1 year, 6 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 06/30/2024
Status: Active
Attachments: No files
Logo Logo
Loading...