Code schaff trend cycle,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42348 quote
    oraclus
    Participant
    Average

    Bonjour ma strategie repose sur l’indicateur Schaff trend cycle de prorealtime qui combine Macd et Stochastic lent. Le problème est que lorsque l’on veut faire un Back test  sur Schaff trend cycle , prorealtime ne veut pas. Le plus simple serait de savoir si quelqu’un le connait le code?

    merci d’avance

    Oraclus

    #42382 quote
    Nicolas
    Keymaster
    Master

    Je viens de faire une petite modif au code de @Francesco ici : https://www.prorealcode.com/topic/why-cant-use-or-call-some-indicator/#post-42380 code Schaff Trend Cycle

    Il est désormais quasi identique à celui de la plateforme et donc être utilisé dans la programmation de stratégie de trading automatique ou de screener, etc.. Je vais m’assurer que ce code figure dans la bibliothèque, il est très souvent demandé 🙂

    EDIT: ajouté à notre bibliothèque de codes prorealtime = Schaff Trend Cycle 

    #42402 quote
    supertiti
    Participant
    Master

    Bonjour

    Venant d’un site espagnol moi j’ai ça :

    // Schaff indicator - Prorealtime formula (presented in the site of Enrico Malverti)
    
    //Schaff indicator Formula
    // presented in the site www.enricomalverti.com, also with  trading rules
    
    Emas = average[b](close)
    Emal = average[l](close)
    Macds =Emas-Emal
    // from Wikipedia %K = 100* ((Price-L5)/(h5-l5)) where h = high of 5 period, l = low
    perck = 100 * (macds - lowest[k](macds))/(highest[k](macds)-lowest[k](macds))
    // from Wikipedia, %D is the 3-day moving average of %K (the last 3 values of %K).
    percd=average[d](perck)
    // PF is %K del %D
    PF = 100 * (macds - lowest[k](percd))/(highest[k](percd)-lowest[k](percd))
    // %D del PF (PFF)
    PFF = average[d](pf)
    
    return pff as " pff "
    
    // Variables :
    //   b, breve periodo - short period, default =  23
    //   l, long period - default = 50
    //  k is the period of %k , default = 10
    //  d for %d is by default = 3
    
    Nicolas and Eikers thanked this post
    #95504 quote
    Nicolas
    Keymaster
    Master

    Pour future référence, le code open source et identique à celui de la plateforme est celui-ci :

    //input parameters
    TCLen = 10
    MA1 = 23
    MA2 = 50
    
    Once Factor = 0.5
    
    if barindex>MA2 then
    //{Calculate a MACD Line}
    XMAC = ExponentialAverage[MA1](Close) - ExponentialAverage[MA2](Close)
    
    //{1st Stochastic: Calculate Stochastic of a MACD}
    Value1 = Lowest[TCLen](XMAC)
    Value2 = Highest[TCLen](XMAC) - Value1
    
    //{%Fast K of MACD}
    if Value2 > 0 then
    Frac1 =  ((XMAC - Value1)/Value2) * 100
    else
    Frac1 = Frac1[1]
    endif
    
    //{Smoothed Calculation for % Fast D of MACD}
    PF = PF[1] + (Factor * (Frac1 - PF[1]))
    
    //{2nd Stochastic: DCalculate Stochastic of smoothed Percent Fast D, 'PF', above}
    Value3 = Lowest[TCLen](PF)
    Value4 = Highest[TCLen](PF) - Value3
    
    //{% of Fast K of PF}
    if Value4 > 0 then
    Frac2 = ((PF - Value3)/Value4) * 100
    else
    Frac2 = Frac2[1]
    endif
    
    //{Smoothed Calculation for %Fast D of PF}
    PFF = PFF[1] + (Factor * (Frac2 - PFF[1]))
    endif
    
    RETURN PFF, 75 coloured(0,0,255) as "level 75", 25 coloured(0,0,255) as "level 25"
    
    rwanderer thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Code schaff trend cycle,


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
oraclus @oraclus Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Nicolas
6 years, 10 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 08/02/2017
Status: Active
Attachments: No files
Logo Logo
Loading...