Rangebound CCI

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #174862 quote
    carlvan
    Participant
    Average

    Bonjour,

    J’ai essayé sans succès de codifier en PRT une formule AFL (Amibroker), au demeurant très simple.
    Le problème est que le résultat en PRT ne correspond; je pense que c’est dû au fait qu’il n’y a pas de fonction “tangente hyperbolique” dans PRT, ou bien devrais-je utiliser ATAN (arc tangente)?? Je dois dire que j’ai oublié mes cours de trigonométrie 😉

    Voici le code en AFL:

    _SECTION_BEGIN(“CCI special”);
    specperiod=Param(“CCI_Period”,14,1,100,1);
    scaleCCI=StDev(CCI(specperiod),3* specperiod); //scale CCI swing
    rbCCI=0.5*(1+tanh(CCI(specperiod)/scaleCCI));
    rbCCI=25*rbCCI; //CCIboundto[0,50]
    rb=rbCCI;
    Plot( rb, “RangeBound_CCI “+ specperiod, ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) );
    Plot( 5, “”, colorWhite);
    Plot( 20, “”,colorWhite);
    _SECTION_END();

    Voici mon code en PRT, mais qui ne fonctionne pas:

    period=14
    scalecci= STD[3*period](cci[period])
    rbcci= 0.5*(1+TAN(cci[period]/scalecci ))
    rbcci= 25*rbcci
    rb= rbcci
    return rb as "RB CCI", 5 as "5", 20 as "20"

     

    Merci de toute aide, cher Nicolas.

    Carl Vanhaesendonck

    Charts-AFL-PRT.jpg Charts-AFL-PRT.jpg
    #174867 quote
    JC_Bywan
    Moderator
    Master

    Bonjour,

    reconstitution de la tangente hyperbolique à partir de l’exponentielle (et supposition que le reste de la traduction de code était ok), image attachée du dow ut jour pour comparer au chart amibroker:

    period=14
    scalecci= STD[3*period](cci[period])
    
    arg= cci[period]/scalecci
    tanharg= (1-exp(-2*arg))/(1+exp(-2*arg))
    
    rbcci= 0.5*(1+tanharg)
    rb= 25*rbcci
    
    return rb as "RB CCI", 5 as "5", 20 as "20"
    Rbcci_avec_calcul_tangente_hyperbolique.png Rbcci_avec_calcul_tangente_hyperbolique.png
    #174872 quote
    carlvan
    Participant
    Average

    Merci beaucoup – c’est parfait !

    #174927 quote
    Zigo
    Participant
    Master

    The same calculation can be done with SMI (14, 5, 3) for example. The indicator becomes more gentle.

    [attachment file=”RB SMI.itf”]

    DOW-Dag.png DOW-Dag.png
    #174933 quote
    carlvan
    Participant
    Average

    Zigo – thank you and indeed, SMI works well when “rangebounded”. I guess this should be tested for other indicators too.

    #174938 quote
    Zigo
    Participant
    Master

    Maybe also other TF’s

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

Rangebound CCI


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
carlvan @carlvan Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Zigo
4 years, 7 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 08/07/2021
Status: Active
Attachments: 3 files
Logo Logo
Loading...