Hello Amibroker Community,
John Ehlers wrote an article on Windowing in the latest S&C September issue, but there was no AFL code in the Traders Tips Section.
Has anyone written AFL code to accompany this article?
Tomasz, I also notice that AFL code is being posted less frequently. Other authors are posting code in Think or Swim Scripting and Excel VBA spreadsheets.
As an average user of Amibroker I rely on the AFL code in the S&C Traders tips section. I'm sure there are other Amibroker users who also rely on this code as well.
Are you supporting S&C as you previously have over the past years?
Please advise,
Thanks for all of your help over the years.
Bernard
2 Likes
beppe
August 26, 2021, 9:36am
#2
@Tomasz already wrote about the TASC Trader's Tips it in a previous post .
Maybe he should check if the recent articles are less repetitive than the last year!
1 Like
fxshrat
August 26, 2021, 11:31am
#3
Here I made AFL functions for Ehlers Windowing
/*
TASC SEP 2021
FIR ... Window Indicators
(C) 2021 John F. Ehlers
AFL code (C) 2021 fxshrat@gmail.com
*/
/// @link https://forum.amibroker.com/t/afl-code-for-s-c-ehlers-windowing-article/27341/3
function f_rad( deg ) {
return deg*4*atan(1)/180;
}
function FIR_ROC(filt, len) {
return len/6.28 * (filt-Ref(filt,-1));
}
function FIR_SMA(len) {
return FIR_ROC(MA(C-O,len), len);
}
function FIR_Triangle(len) {
half_len = len/2;
for ( i = 0; i < Min(len, BarCount); i++ ) {
cnt = i+1;
if ( cnt < half_len ) coeff[i] = cnt;
else
if ( cnt == half_len ) coeff[i] = half_len;
else coeff[i] = len-i;
}
filt = FIR(C-O,coeff,len);
return FIR_ROC(filt, len);
}
function FIR_Hamming(len, ped) {
for ( i = 0; i < Min(len, BarCount); i++ ) {
idx = 1 - i / (len-1);
rad = f_rad(ped+(180-2*ped)*idx);
coeff[i] = sin(rad);
}
filt = FIR(C-O,coeff,len);
return FIR_ROC(filt, len);
}
function FIR_Hann(len) {
for ( i = 0; i < Min(len, BarCount); i++ ) {
idx = (len-i) / (len+1);
rad = f_rad(360*idx);
coeff[i] = 1 - cos(rad);
}
filt = FIR(C-O,coeff,len);
return FIR_ROC(filt, len);
}
len = 20;
x1 = FIR_SMA(len);
Plot( x1, "FIR_SMA", colorOrange );
x2 = FIR_Triangle(len);
Plot( x2, "FIR_Triangle", colorRed );
x3 = FIR_Hamming(len, 10);
Plot( x3, "FIR_Hamming", colorYellow );
x4 = FIR_Hann(len);
Plot( x4, "FIR_Hann", colorAqua );
PlotGrid(0, colorRed);
15 Likes
system
Closed
December 17, 2021, 5:33pm
#7
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.