+91-0000000000

}

Monday – Friday : 9:00 AM – 6:30 PM

Detrend

Detrending involves removing the trend component from a financial instrument’s price data. Through Amibroker AFL, traders can create detrending algorithms to isolate the cyclic or non-trend elements in the data, allowing for a clearer analysis of underlying patterns or fluctuations.

/
_SECTION_BEGIN("Detrend");
function detrend(P)
{
d=P;
d2=P*0;
dt=P*0;
for(i=13;i


{
d[i] = 0.912*P[i]+0.088*d[i-6];
d2[i] = (d[i] - d[i-6]) + (1.2*d2[i-6] - 0.7*d2[i-12]);
dt[i]=(d2[i-12]-d2[i-6])+(d2[i]-d2[i-6]);
}

return dt;
}

Price = (H+L)/2;
Plot(detrend(Price), "Detrend", colorRed, styleLine);
_SECTION_END();

Open chat
1
Hi, how can I help you?