Heikin Ashi Differential
Forums › ProRealTime forum Français › Support ProBuilder › Heikin Ashi Differential
- This topic has 5 replies, 2 voices, and was last updated 3 years ago by carlvan.
-
-
04/04/2021 at 4:07 PM #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);04/05/2021 at 2:47 PM #16620804/05/2021 at 2:55 PM #16620904/06/2021 at 9:03 AM #166227I 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/
04/06/2021 at 12:00 PM #166265Yes 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 🙂
04/06/2021 at 12:03 PM #166266Here 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= 30haclose=(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”
-
AuthorPosts