VininI LRMA color
Download scriptThis tool is designed to help traders visualize market momentum and price trends by identifying specific shifts in the asset's behavior. Rather than just looking at raw price movements, it uses a customized mathematical approach to smooth out market "noise" and highlight the underlying direction of the trend.
Core Logic and Methodology
The script functions by calculating two different types of moving averages simultaneously. While standard indicators often rely on one type of average, this logic combines a Simple Moving Average (SMA) and a Linear Weighted Moving Average (LWMA).
By blending these two distinct averages using a specific weighted formula, the tool creates a refined "signal line." This signal line acts as a smoothed representation of price action, designed to be more responsive to current changes than a standard average would be on its own.
Visual Representation
The indicator translates these mathematical calculations into three distinct visual states on your chart:
- Trend Identification: The tool constantly monitors the direction of this refined signal line. If the line moves upward (indicating bullish momentum), it highlights that specific movement.
- Dynamic Coloring: To make the data easy to read at a glance, the script uses a color-coding system. It detects whether the current value is higher or lower than the previous one:
- When the signal indicates an upward trend, the visual output reflects this through specific coloring (Green/Yellow logic).
- When the signal indicates a downward trend, it switches to represent the decline (Red logic).
- Stability Filtering: If the price action is flat—meaning there is no significant upward or downward movement—the tool suppresses the signals to avoid providing "false" readings during periods of consolidation.
Key Benefits for the User
- Smoothed Data: By blending two different moving average types, it attempts to provide a cleaner view of the market than many standard indicators.
- Visual Clarity: Instead of forcing the trader to interpret complex numbers, the tool does the heavy lifting by changing the visual cues based on whether momentum is increasing or decreasing.
- Customizable Sensitivity: The period settings allow you to adjust how much historical data the tool considers, enabling you to switch between identifying short-term "swings" and long-term structural trends.
//+------------------------------------------------------------------+
//| 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 3
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red
extern int period=34;
extern int price=0;
extern int Shift=0;
//---- buffers
double BufferGreen[];
double BufferYellow[];
double BufferRed[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
int i;
for (i=0;i<3;i++) {
SetIndexStyle(i,DRAW_LINE);
SetIndexDrawBegin(i,period);
SetIndexShift(i,Shift);
}
SetIndexBuffer(0,BufferYellow);
SetIndexBuffer(1,BufferGreen);
SetIndexBuffer(2,BufferRed);
return(0); }//int init()
//+------------------------------------------------------------------+
int start() {
int limit;
double tmp1,tmp2,tmp3;
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;
int cmd;
for (i = limit;i>=0;i--){
tmp1=iMA(Symbol(),0,period,0,MODE_SMA,price,i);
tmp2=iMA(Symbol(),0,period,0,MODE_LWMA,price,i);
tmp3=3.0*tmp2-2.0*tmp1;
BufferGreen[i] =tmp3;
BufferYellow[i]=tmp3;
BufferRed[i] =tmp3;
if (BufferYellow[i]>BufferYellow[i+1]){
BufferRed[i]=EMPTY_VALUE;
} else if (BufferYellow[i]<BufferYellow[i+1]){
BufferGreen[i] =EMPTY_VALUE;
} else {
BufferRed[i]=EMPTY_VALUE;
BufferGreen[i] =EMPTY_VALUE;
}
}
return(0);
}
Comments