Heikin Ashi Differential

Forums ProRealTime forum Français Support ProBuilder Heikin Ashi Differential

Viewing 6 posts - 1 through 6 (of 6 total)
  • #166167

    Bonjour Nicolas,

    Je ne parviens pas à convertir cette formule AFL Amibroker (au demeurant très simple) en code AFL: je bute sur la formule AMA (adaptive MA) et je n’obtiens jamais le même résultat sur PRT.

    Merci d’avance pour votre aide – j’ai joint un chart Amibroker.

    Carl

    Voici le code AFL:

    HaClose=(O+H+L+C)/4;
    HaOpen=AMA(Ref(HaClose,-1),0.5); //Adaptive Moving Average du HaClose précédent, avec smoothing factor de 0.5
    HaDiffCO = (HaClose-HaOpen);

    HaClose2=(H+L+C)/3;
    HaOpen2=AMA(Ref(HaClose2,-1),0.1); //Adaptive Moving Average du HaClose2 précédent, avec smoothing factor de 0.1 cette fois
    //HaHigh2=Max(H,Max(HaClose2,HaOpen2));
    //HaLow2=Min(L,Min(HaClose2,HaOpen2));
    HaDiffCO2 = HaClose2-HaOpen2;

    HDCPeriods = 15;
    Width = Param(“Width”, 2, 0, 10, 0.05 );

    Plot( BBandTop( Hadiffco, HDCPeriods, Width ), “BBTop” + _PARAM_VALUES(), Colorblack, Styleline);
    Plot( BBandBot( Hadiffco, HDCPeriods, Width ), “BBBot” + _PARAM_VALUES(), Colorblack, Styleline);
    Plot(HaDiffCO,”HaDiffCO”,colorDarkRed,styleThick|styleLine);
    Plot(HaDiffCO2,”HaDiffCO2″,colorGreen,styleThick|styleLine);

    #166208
    #166209

    Oui, c’est bien cette formule AFL- là pour l’AMA, mais je ne parviens pas à la convertir en code PRT.

    Merci.

     

    #166227

    I know I’ve been there before years ago, but I can’t find the code I made for at that time..

    Did you test those in this topic? https://www.prorealcode.com/topic/adaptive-moving-average-ama/

    #166265

    Yes I tested those but it does not give the same results as with the AFL code unfortunately. Also, there are those 3 variables in the current PRT formula (period, fast and slow) that has no equivalence to the smoothing factor used in the AFL code (0.5 for the HaDiffCo and 0.1 for HaDiffCo2).

    So what I did was trying to reproduce the same AMA based on the AFL explanation for the AMA function within Amibroker doc:

    output = AMA( input, factor )
    for( i = 1; i < BarCount; i++ )
    {
    output[ i ] = factor[ i ] * input[ i ] + ( 1 – factor[ i ] ) * output[ i – 1 ];
    }

    But I have never been good with looping formulas 🙂

     

     

     

     

    #166266

    Here is the closest I could get with my current PRT formula from the AFL code but again, not the same results on the chart:

    //Period = 9
    //FastPeriod = 1
    //SlowPeriod = 30
    //Period2=18
    //Fast2= 2
    //Slow2= 30

    haclose=(open+close+low+high)/4
    haopen= AdaptiveAverage[period,fast,slow](haclose)[1]

    haclose2=(close+low+high)/3
    haopen2= AdaptiveAverage[period2,fast2,slow2](haclose2)[1]

    HaDiffCO = (HaClose-HaOpen)
    HaDiffCO2 = HaClose2-HaOpen2
    //HaLow2=Min(L,Min(HaClose2,HaOpen2));
    sDev = std[15](hadiffco)
    avg = average[15](hadiffco)
    UpperBand = avg+(2*sDev)
    LowerBand = avg-(2*sDev)

    RETURN hadiffco as “HaDiffCo”, hadiffco2 as “HaDiffCo2”, 0 as “Zero”, upperband as “UpBB”, lowerband as “LoBB”

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login