lsma_VininLRMA
Download scriptThis technical tool is designed to provide a visual trend signal on your trading charts by analyzing price movements over a specific timeframe. Rather than simply looking at the raw price of an asset, it focuses on identifying smoothed trends to help filter out "market noise."
Core Logic and Mechanism
The script operates by calculating two different types of moving averages simultaneously. A moving average is a standard financial tool used to smooth out price fluctuations; however, this specific indicator uses two distinct calculation methods:
- Simple Moving Average (SMA): This provides a steady, linear average of the price over the selected period.
- Linear Weighted Moving Average (LWMA): This method gives more importance and "weight" to recent price action, making it more responsive to immediate market changes than a standard average.
How the Signal is Generated
The unique logic of this indicator lies in how it combines these two averages. Instead of showing you either one or the other, it performs a weighted mathematical calculation:
- It takes three parts of the Weighted Average and subtracts two parts of the Simple Average.
- The result is plotted on your chart as a single continuous line.
By blending these two types of averages in this specific ratio (3:2), the indicator aims to create a smoother, more refined trend line. Because it prioritizes the weighted average while still accounting for the simple average, it seeks to balance responsiveness to current price swings with the overall stability of the long-term trend.
Key Features for the User
- Customizable Sensitivity: The primary setting allows you to define the "period." A larger period will result in a smoother line that focuses on long-term trends, while a smaller period will make the line more reactive to short-term price changes.
- Visual Clarity: The resulting data is displayed as a yellow line directly on your main chart window, allowing you to see the calculated trend momentum clearly alongside the live price action.
//+------------------------------------------------------------------+
//| Vinin HighLow v1.mq4 |
//| Victor Nicolaev aka Vinin |
//| vinin@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Victor Nicolaev aka Vinin"
#property link "mailto: vinin@mail.ru"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
extern int period=89;
//---- buffers
double Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,0);
SetIndexBuffer(0,Buffer);
return(0); }//int init()
//+------------------------------------------------------------------+
int start() {
int limit;
double tmp1,tmp2;
int tmpBar, tmpTime;
int counted_bars=IndicatorCounted();
int i, j,k;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (i = limit;i>=0;i--){
tmp1=iMA(Symbol(),0,period,0,MODE_SMA,PRICE_CLOSE,i);
tmp2=iMA(Symbol(),0,period,0,MODE_LWMA,PRICE_CLOSE,i);
Buffer[i]=NormalizeDouble(3.0*tmp2-2.0*tmp1,Digits);
}
return(0);
}
Comments