RFTL_v2
Download scriptThis tool is a specialized technical indicator designed for the MetaTrader platform to assist traders in analyzing price movements. Its primary function is to generate a smoothed, calculated line on your trading chart based on historical price data.
Core Logic and Functionality
The indicator operates using a mathematical technique known as Weighted Linear Regression. Instead of simply looking at the most recent price, the script evaluates a specific window of past market activity—specifically the last 45 closing prices.
Here is how the logic works in plain terms:
- Data Weighting: The script assigns a unique "weight" (a specific numerical importance) to each of the past 45 price points. This means it does not treat all historical data equally; some periods are given more significance than others to help identify the underlying trend while filtering out minor market "noise."
- Trend Smoothing: By combining these weighted values into a single calculation, the indicator produces a continuous line. This allows traders to see a clearer picture of the price direction (the trajectory) without being distracted by the rapid, erratic fluctuations of the live market.
- Visual Representation: The resulting data is plotted directly on the chart as a red line. Traders use this visual aid to identify whether the current momentum is trending upward, downward, or remaining neutral.
- Dynamic Updates: The calculation automatically refreshes as new price candles close, ensuring that the displayed trend line remains relevant to the most recent market conditions.
Summary for the User
In essence, this script acts as a sophisticated "filter." It takes a complex history of 45 price points, applies a precise mathematical formula to prioritize the most meaningful data, and converts it into a clean, readable red line on your screen to help you better visualize market trends.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| RFTL.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property copyright "Copyright 2002, Finware.ru Ltd."
#property link "http://www.finware.ru/"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int CountBars=300;
//---- buffers
double RFTLBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,RFTLBuffer);
//----
return(0);
}
//+------------------------------------------------------------------+
//| RFTL |
//+------------------------------------------------------------------+
int start()
{
SetIndexDrawBegin(0,Bars-CountBars+44);
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=44) return(0);
//---- initial zero
if(counted_bars<44)
for(i=1;i<=0;i++) RFTLBuffer[CountBars-i]=0.0;
//----
i=CountBars-44-1;
// if(counted_bars>=44) i=Bars-counted_bars-1;
while(i>=0)
{
RFTLBuffer[i]=
-0.02232324*Close[i+0]
+0.02268676*Close[i+1]
+0.08389067*Close[i+2]
+0.14630380*Close[i+3]
+0.19282649*Close[i+4]
+0.21002638*Close[i+5]
+0.19282649*Close[i+6]
+0.14630380*Close[i+7]
+0.08389067*Close[i+8]
+0.02268676*Close[i+9]
-0.02232324*Close[i+10]
-0.04296564*Close[i+11]
-0.03980614*Close[i+12]
-0.02082171*Close[i+13]
+0.00243636*Close[i+14]
+0.01950580*Close[i+15]
+0.02460929*Close[i+16]
+0.01799295*Close[i+17]
+0.00470540*Close[i+18]
-0.00831985*Close[i+19]
-0.01544722*Close[i+20]
-0.01456262*Close[i+21]
-0.00733980*Close[i+22]
+0.00201852*Close[i+23]
+0.00902504*Close[i+24]
+0.01093067*Close[i+25]
+0.00766099*Close[i+26]
+0.00145478*Close[i+27]
-0.00447175*Close[i+28]
-0.00750446*Close[i+29]
-0.00671646*Close[i+30]
-0.00304016*Close[i+31]
+0.00143433*Close[i+32]
+0.00457475*Close[i+33]
+0.00517589*Close[i+34]
+0.00336708*Close[i+35]
+0.00034406*Close[i+36]
-0.00233637*Close[i+37]
-0.00352280*Close[i+38]
-0.00293522*Close[i+39]
-0.00114249*Close[i+40]
+0.00083536*Close[i+41]
+0.00215524*Close[i+42]
+0.00604133*Close[i+43]
-0.00013046*Close[i+44];
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments