Comportement différent d'un indicateur qd appelé dans un backtest

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8309 quote
    François
    Participant
    Average

    Hello All,

    ci-dessous un code pour calculer les points pivots mensuels.

    Qd posé sur le graphe, cet indicateur donne exactement le même résultat que l’indicateur points pivots de PRT.

    if (month > month[1]) or (month=1 and month[1]=12) then
    monthHigh = prevMonthHigh
    monthLow = prevMonthLow
    monthClose = prevMonthClose
    prevMonthHigh = high
    prevMonthLow = low
    endif
    prevMonthHigh = max(prevMonthHigh, high)
    prevMonthLow = min(prevMonthLow, low)
    prevMonthClose = close
    
    p = (monthHigh + monthLow + monthclose) / 3
    
    S1 = (p*2)-monthHigh
    S2 = p-(monthHigh-monthLow)
    S3 = monthLow-2*(monthHigh-p)
    
    Res1 = (p*2)-monthLow
    Res2 = p+(monthHigh-monthLow)
    Res3 = monthHigh+2*(p-monthLow)
    
    return p, S1 as "S1", S2 as "S2", S3 as "S3", Res1 as "R1", Res2 as "R2", Res3 as "R3"

    Mais, ce même indicateur appelé dans un backtest donne des valeurs différentes, pas de bcp.

    Sur l’image en bleu les points pivot PRT égaux aux points pivots du code ci-dessus et en noir les points pivots du code ci-dessus appelés dans le backtest.

    Qq a une explication ou a déjà rencontré un problème similaire?

     

    F.

    #8314 quote
    Nicolas
    Keymaster
    Master

    Il n’y a peut-être pas suffisamment de bars dans l’historique quand tu lances ton back test. Il faudrait peut-être en ajouter avec preloadbars.

    #8321 quote
    François
    Participant
    Average

    Je viens d’essayer mais ca n’a pas d’effet.

    Voici le code du backtest que j’ai minimisé au max:

    DEFPARAM PRELOADBARS = 300
    
    pp, ignored, ignored, ignored, ignored, ignored, ignored = CALL "Pivot Points Monthly"
    graph pp
    //graph myS1
    //graph myS2
    //graph myS3
    //graph myR1
    //graph myR2
    //graph myR3
    
    if 0 = 1 then
    buy 1 cash at close limit
    endif
    

    La seule chose qui me vient à l’esprit est un problème d’arrondi.

    A propos j’utilise la version journalière, peut-être que les données affichées et les données du backtest diffèrent?

    #8322 quote
    larouedegann
    Participant
    Master

    Bonjour,

    Regarde sur PRT si la bonne formule du calcul du point pivot est utilisé.

    3 sorte de calculs pour déterminer un point pivot journalier.

    (h+b+c)/3

    (h+b+c+o du jour)/4  —-> o.du mois pour toi

    (h+b+o du jour)/3      ——>o. du mois pour toi

    Salutations

    #8323 quote
    François
    Participant
    Average

    Je ne saurai pas expliqué pourquoi cette différence mais en modifiant le code de l’indicateur comme ci-dessous, ca fonctionne.

    if (month > month[1]) or (month=1 and month[1]=12) then
    monthHigh = prevMonthHigh
    monthLow = prevMonthLow
    monthClose = prevMonthClose
    prevMonthHigh = high
    prevMonthLow = low
    else
    prevMonthHigh = max(prevMonthHigh, high)
    prevMonthLow = min(prevMonthLow, low)
    prevMonthClose = close
    endif
    
    p = (monthHigh + monthLow + monthclose) / 3
    
    S1 = (p*2)-monthHigh
    S2 = p-(monthHigh-monthLow)
    S3 = monthLow-2*(monthHigh-p)
    
    Res1 = (p*2)-monthLow
    Res2 = p+(monthHigh-monthLow)
    Res3 = monthHigh+2*(p-monthLow)
    
    return p, S1 as "S1", S2 as "S2", S3 as "S3", Res1 as "R1", Res2 as "R2", Res3 as "R3"
    
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Comportement différent d'un indicateur qd appelé dans un backtest


Support ProOrder

New Reply
Author
author-avatar
François @ftanguy Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by François
9 years, 7 months ago.

Topic Details
Forum: Support ProOrder
Language: French
Started: 05/29/2016
Status: Active
Attachments: No files
Logo Logo
Loading...