FTLM
Download scriptOverview
The Fast Trend Line Momentum (FTLM) Digital Filter is a specialized technical analysis tool designed to identify and visualize market momentum by filtering out "market noise." Unlike standard moving averages that simply smooth out price data, this script employs a sophisticated mathematical approach to distinguish between significant trend movements and minor price fluctuations.
How the Logic Works
The core functionality of this indicator relies on a high-precision digital filter. Here is a breakdown of the logic in plain terms:
1. Multi-Point Data Analysis Instead of looking at just the current price or a simple average of the last few candles, the script examines a significant window of historical data (specifically 44 data points). It assigns a unique mathematical weight to each of these points. Some prices are given heavy importance, while others are slightly discounted or even subtracted. This allows the tool to "understand" the shape of the recent price action more deeply than a human eye can quickly perceive.
2. Dual-Stream Calculation The script performs two separate complex calculations simultaneously:
- Current State: It calculates the momentum based on the most recent available data.
- Previous State: It calculates the momentum based on the data immediately preceding the current set.
By performing these two calculations, the tool creates a comparison between "where the market is now" versus "where it was just a moment ago."
3. Momentum Filtering (The Result) The script then subtracts the previous state from the current state to determine the net momentum. The results are visualized as a histogram in a separate window:
- Upward Momentum: When the current momentum is stronger than the previous state, the indicator shows a value in Blue. This suggests that the buying pressure or upward trend is accelerating.
- Downward Momentum: When the current momentum is weaker (or falling) compared to the previous state, the indicator shows a value in Red. This suggests that selling pressure or the downward trend is gaining strength.
Summary for Traders
The purpose of this logic is to provide a "clean" look at market direction. By using these specific mathematical weights, the filter attempts to ignore the constant "jitter" of the market, highlighting only the meaningful shifts in momentum. When you see the histogram bars shifting from one color to another, it indicates a significant change in the underlying trend's velocity.
// ========================================================================================= //
// F A S T T R E N D L I N E M O M E N T U M //
// FTLM Digital Filter //
// modified by © 2007 Wibisono Hoesen //
// ========================================================================================= //
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
double Up[];
double Down[];
// ========================================================================================= //
// I N I T I A L I S A T I O N //
// ========================================================================================= //
int init()
{
string short_name;
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexBuffer(0,Up);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexBuffer(1,Down);
return(0);
}
// ========================================================================================= //
// S T A R T O F E A //
// ========================================================================================= //
int start()
{
int i,i2,counted_bars = IndicatorCounted();
double FTLM,FTLM1,value1,value2,value3,value4;
if(Bars<=43) return(0);
if(counted_bars<43)
{
for(i=1;i<=0;i++) Up[Bars-i] = 0.0;
for(i=1;i<=0;i++) Down[Bars-i] = 0.0;
}
i = Bars-43-1;
if(counted_bars>=43) i = Bars-counted_bars-1;
while(i>=0)
{
value1 =
0.4360409450*Close[i+0]
+0.3658689069*Close[i+1]
+0.2460452079*Close[i+2]
+0.1104506886*Close[i+3]
-0.0054034585*Close[i+4]
-0.0760367731*Close[i+5]
-0.0933058722*Close[i+6]
-0.0670110374*Close[i+7]
-0.0190795053*Close[i+8]
+0.0259609206*Close[i+9]
+0.0502044896*Close[i+10]
+0.0477818607*Close[i+11]
+0.0249252327*Close[i+12]
-0.0047706151*Close[i+13]
-0.0272432537*Close[i+14]
-0.0338917071*Close[i+15]
-0.0244141482*Close[i+16]
-0.0055774838*Close[i+17]
+0.0128149838*Close[i+18]
+0.0226522218*Close[i+19]
+0.0208778257*Close[i+20]
+0.0100299086*Close[i+21]
-0.0036771622*Close[i+22]
-0.0136744850*Close[i+23]
-0.0160483392*Close[i+24]
-0.0108597376*Close[i+25]
-0.0016060704*Close[i+26]
+0.0069480557*Close[i+27]
+0.0110573605*Close[i+28]
+0.0095711419*Close[i+29]
+0.0040444064*Close[i+30]
-0.0023824623*Close[i+31]
-0.0067093714*Close[i+32]
-0.0072003400*Close[i+33]
-0.0047717710*Close[i+34]
+0.0005541115*Close[i+35]
+0.0007860160*Close[i+36]
+0.0130129076*Close[i+37]
+0.0040364019*Close[i+38];
value2 =
-0.0025097319*Close[i+0]
+0.0513007762*Close[i+1]
+0.1142800493*Close[i+2]
+0.1699342860*Close[i+3]
+0.2025269304*Close[i+4]
+0.2025269304*Close[i+5]
+0.1699342860*Close[i+6]
+0.1142800493*Close[i+7]
+0.0513007762*Close[i+8]
-0.0025097319*Close[i+9]
-0.0353166244*Close[i+10]
-0.0433375629*Close[i+11]
-0.0311244617*Close[i+12]
-0.0088618137*Close[i+13]
+0.0120580088*Close[i+14]
+0.0233183633*Close[i+15]
+0.0221931304*Close[i+16]
+0.0115769653*Close[i+17]
-0.0022157966*Close[i+18]
-0.0126536111*Close[i+19]
-0.0157416029*Close[i+20]
-0.0113395830*Close[i+21]
-0.0025905610*Close[i+22]
+0.0059521459*Close[i+23]
+0.0105212252*Close[i+24]
+0.0096970755*Close[i+25]
+0.0046585685*Close[i+26]
-0.0017079230*Close[i+27]
-0.0063513565*Close[i+28]
-0.0074539350*Close[i+29]
-0.0050439973*Close[i+30]
-0.0007459678*Close[i+31]
+0.0032271474*Close[i+32]
+0.0051357867*Close[i+33]
+0.0044454862*Close[i+34]
+0.0018784961*Close[i+35]
-0.0011065767*Close[i+36]
-0.0031162862*Close[i+37]
-0.0033443253*Close[i+38]
-0.0022163335*Close[i+39]
+0.0002573669*Close[i+40]
+0.0003650790*Close[i+41]
+0.0060440751*Close[i+42]
+0.0018747783*Close[i+43];
value3 =
0.4360409450*Close[i+0+1]
+0.3658689069*Close[i+1+1]
+0.2460452079*Close[i+2+1]
+0.1104506886*Close[i+3+1]
-0.0054034585*Close[i+4+1]
-0.0760367731*Close[i+5+1]
-0.0933058722*Close[i+6+1]
-0.0670110374*Close[i+7+1]
-0.0190795053*Close[i+8+1]
+0.0259609206*Close[i+9+1]
+0.0502044896*Close[i+10+1]
+0.0477818607*Close[i+11+1]
+0.0249252327*Close[i+12+1]
-0.0047706151*Close[i+13+1]
-0.0272432537*Close[i+14+1]
-0.0338917071*Close[i+15+1]
-0.0244141482*Close[i+16+1]
-0.0055774838*Close[i+17+1]
+0.0128149838*Close[i+18+1]
+0.0226522218*Close[i+19+1]
+0.0208778257*Close[i+20+1]
+0.0100299086*Close[i+21+1]
-0.0036771622*Close[i+22+1]
-0.0136744850*Close[i+23+1]
-0.0160483392*Close[i+24+1]
-0.0108597376*Close[i+25+1]
-0.0016060704*Close[i+26+1]
+0.0069480557*Close[i+27+1]
+0.0110573605*Close[i+28+1]
+0.0095711419*Close[i+29+1]
+0.0040444064*Close[i+30+1]
-0.0023824623*Close[i+31+1]
-0.0067093714*Close[i+32+1]
-0.0072003400*Close[i+33+1]
-0.0047717710*Close[i+34+1]
+0.0005541115*Close[i+35+1]
+0.0007860160*Close[i+36+1]
+0.0130129076*Close[i+37+1]
+0.0040364019*Close[i+38+1];
value4 =
-0.0025097319*Close[i+0+1]
+0.0513007762*Close[i+1+1]
+0.1142800493*Close[i+2+1]
+0.1699342860*Close[i+3+1]
+0.2025269304*Close[i+4+1]
+0.2025269304*Close[i+5+1]
+0.1699342860*Close[i+6+1]
+0.1142800493*Close[i+7+1]
+0.0513007762*Close[i+8+1]
-0.0025097319*Close[i+9+1]
-0.0353166244*Close[i+10+1]
-0.0433375629*Close[i+11+1]
-0.0311244617*Close[i+12+1]
-0.0088618137*Close[i+13+1]
+0.0120580088*Close[i+14+1]
+0.0233183633*Close[i+15+1]
+0.0221931304*Close[i+16+1]
+0.0115769653*Close[i+17+1]
-0.0022157966*Close[i+18+1]
-0.0126536111*Close[i+19+1]
-0.0157416029*Close[i+20+1]
-0.0113395830*Close[i+21+1]
-0.0025905610*Close[i+22+1]
+0.0059521459*Close[i+23+1]
+0.0105212252*Close[i+24+1]
+0.0096970755*Close[i+25+1]
+0.0046585685*Close[i+26+1]
-0.0017079230*Close[i+27+1]
-0.0063513565*Close[i+28+1]
-0.0074539350*Close[i+29+1]
-0.0050439973*Close[i+30+1]
-0.0007459678*Close[i+31+1]
+0.0032271474*Close[i+32+1]
+0.0051357867*Close[i+33+1]
+0.0044454862*Close[i+34+1]
+0.0018784961*Close[i+35+1]
-0.0011065767*Close[i+36+1]
-0.0031162862*Close[i+37+1]
-0.0033443253*Close[i+38+1]
-0.0022163335*Close[i+39+1]
+0.0002573669*Close[i+40+1]
+0.0003650790*Close[i+41+1]
+0.0060440751*Close[i+42+1]
+0.0018747783*Close[i+43+1];
FTLM = value1-value2;
FTLM1 = value3-value4;
if (FTLM>FTLM1) {Up[i]=FTLM;Down[i]=0.0;} else {Down[i]=FTLM;Up[i]=0.0;}
i--;
}
return(0);
}
// ========================================================================================= //
// E N D O F P R O G R A M //
// ========================================================================================= //
Comments