Priliv_s_v1
Download scriptThis script is a specialized technical analysis tool designed to visualize the momentum and speed of market trends across different timeframes simultaneously. Instead of simply showing where the price is, it focuses on how fast the price is moving in specific directions.
Core Functionality
The indicator calculates and displays three distinct lines on a separate window. Each line represents the "velocity" of the trend for a different scope:
- Current Timeframe: Shows the immediate speed of the market trend based on the chart you are currently viewing.
- Next Higher Timeframe: Projects the trend speed of the next logical step up in time (e.g., if you are on a 1-hour chart, it looks at the 4-hour trend).
- Second Higher Timeframe: Projects the trend speed of the timeframe even further out.
How the Logic Works
The script achieves this by analyzing moving averages and calculating their "spread" over various distances:
- Dynamic Scaling: The tool automatically detects which timeframe you are using (e.g., 15 minutes, 1 hour, daily) and adjusts its internal calculations to match the appropriate proportions for that specific window.
- Momentum Calculation: It doesn't just look at a single price point. It takes a moving average of the current price and compares it against several weighted moving averages from further back in time. By measuring the difference between these points, it determines if the trend is accelerating, decelerating, or remaining steady.
- Smoothing: To ensure the data is readable and not erratic, the script aggregates these differences into a consistent flow, creating smooth lines that represent the "force" behind the price movement.
How to Interpret the Visuals
The primary goal of this indicator is to help traders identify trend shifts before they become obvious on the main chart:
- Trend Direction: When the lines move upward, it indicates positive momentum; downward movement indicates negative momentum.
- Trend Changes: A "bend" or significant shift in the direction of these lines serves as a signal that the current market trend may be changing.
- Multi-Timeframe Awareness: Because it shows three different lines at once, a trader can see if the short-term movement is supported by the larger long-term trends. If the current timeframe line is moving up but the higher timeframe lines are pointing down, it suggests a temporary "pullback" rather than a permanent trend change.
//+------------------------------------------------------------------+
//| |
//| Copyright © 1999-2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.ru |
//+------------------------------------------------------------------+
// Priliv_s.mq4
// Ðàçâîðîòíûé èíäèêàòîð.
// Ðàñïðîñòðàíÿåòñÿ áåñïëàòíî áåç îãðàíè÷åíèé.
// Ñåðãåé Êîâàë¸â, Äíåïðîïåòðîâñê, sk@mail.dnepr.net, http://autograf.dp.ua , ICQ 64015987
//--------------------------------------------------------------------------------------------------------------------
// Îòîáðàæàåò 3 ëèíèè ðàçíîãî öâåòà, ïîêàçûâàÿ ñêîðîñòü òðåíäà íà òåêóùåì, áëèæàéøåì áîëüøåì è ñëåäóþùåì áîëüøåì ÒÔ.
// Áåæåâûé öâåò ëèíèè îçíà÷àåò ðàñ÷¸ò ñ íàèìåíüøèì ïåðèîäîì (òåêóùèé ÒÔ). Çåë¸íûé öâåò - îòîáðàæåíèå â òåêóùåì ÒÔ
// ëèíèè áëèæàéøåãî ñòàðøåãî ÒÔ. Êðàñíàÿ ëèíèÿ èñïîëüçóåòñÿ äëÿ îòîáðàæåíèÿ òåíäåíöèè â ñëåäóþùåì ñòàðøåì ÒÔ.
// Ìîæåò ïðèìåíÿòüñÿ íà ëþáûõ òàéìôðåéìàõ. Ïåðåãèá èíäèêàòîðà îçíà÷àåò ñìåíó íàïðàâëåíèÿ òðåíäà.
//--------------------------------------------------------------------------------------------------------------------
#property copyright "Copyright © SK, 2006"
#property link "http://autograf.dp.ua"
//----
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 Wheat
#property indicator_color3 DarkSeaGreen
#property indicator_color4 DarkSalmon
//--------------------------------------------------------------------------------------------------------------------
extern int CountBars=5000;
int i,n,k, counted_bars, K2, K3, Period_MA_2, Period_MA_3;
int Period_MA_0=8;
int Period_MA_1=21;
int Kol_Line=20;
//--------------------------------------------------------------------------------------------------------------------
double Buf_1[]; // Áóôôåð îïîðíîé MA
double Buf_2[]; // Áóôôåð èíäèêàòîðà òåêóùåãî ÒÔ
double Buf_3[]; // Áóôôåð èíäèêàòîðà áëèæàéøåãî áîëüøåãî ÒÔ
double Buf_4[]; // Áóôôåð èíäèêàòîðà ñëåäóþùåãî áîëüøåãî ÒÔ
double MA_0, MA_11, MA_12, MA_13, MA_14;
double Polzun_1[21],Polzun_2[21],Polzun_3[21],Line[21];
double KK=1.2;
double K=5;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
switch(Period())
{
case 1: K2=5; K3=15; break;
case 5: K2=3; K3= 6; break;
case 15: K2=2; K3= 4; break;
case 30: K2=2; K3= 8; break;
case 60: K2=4; K3=24; break;
case 240: K2=6; K3=42; break;
case 1440: K2=7; K3=30; break;
case 10080: K2=4; K3= 0; break;
case 43200: K2=0; K3= 0; break;
}
Polzun_1[1]=20;
Polzun_2[1]=Polzun_1[1]*K2; Period_MA_2=Period_MA_1*K2;
Polzun_3[1]=Polzun_1[1]*K3; Period_MA_3=Period_MA_1*K3;
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (0,DRAW_LINE);
SetIndexBuffer(0,Buf_1);
SetIndexDrawBegin(0, Bars-CountBars);
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (1,DRAW_LINE);
SetIndexBuffer(1,Buf_2);
SetIndexDrawBegin(1, Bars-CountBars);
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (2,DRAW_LINE);
SetIndexBuffer(2,Buf_3);
SetIndexDrawBegin(2, Bars-CountBars);
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (3,DRAW_LINE);
SetIndexBuffer(3,Buf_4);
SetIndexDrawBegin(3, Bars-CountBars);
//--------------------------------------------------------------------------------------------------------------------
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
//====================================================================================================================
counted_bars=IndicatorCounted();
i=Bars-counted_bars-1;
//--------------------------------------------------------------------------------------------------------------------
for(n=2;n<=Kol_Line;n++)
{
k=n-1;
Polzun_1[n]=Polzun_1[k]/KK;
Polzun_2[n]=Polzun_2[k]/KK;
Polzun_3[n]=Polzun_3[k]/KK;
}
//====================================================================================================================
while(i>=0)
{
//--------------------------------------------------------------------------------------------------------------------
Buf_1[i]=0;
//--------------------------------------------------------------------------------------------------------------------
Buf_2[i]= 0;
MA_11=iMA( NULL, 0, Period_MA_1, 0, MODE_LWMA, PRICE_TYPICAL, i );
for(n=1;n<=Kol_Line;n++)
{
MA_12=iMA( NULL, 0, Period_MA_1, 0, MODE_LWMA, PRICE_TYPICAL, i +Polzun_1[n]);
Line[n]=MA_11-MA_12;
Buf_2[i]=Buf_2[i]+Line[n];
}
Buf_2[i]= K*Buf_2[i]/Kol_Line;
Buf_2[i]=Buf_2[i]*1000;
//--------------------------------------------------------------------------------------------------------------------
Buf_3[i]= 0;
MA_11=iMA( NULL, 0, Period_MA_2, 0, MODE_LWMA, PRICE_TYPICAL, i );
for(n=1;n<=Kol_Line;n++)
{
MA_12=iMA( NULL, 0, Period_MA_2, 0, MODE_LWMA, PRICE_TYPICAL, i +Polzun_2[n]);
Line[n]=MA_11-MA_12;
Buf_3[i]=Buf_3[i]+Line[n];
}
Buf_3[i]= K*Buf_3[i]/Kol_Line;
Buf_3[i]=Buf_3[i]*1000;
if (K2==0)Buf_3[i]=0;
//--------------------------------------------------------------------------------------------------------------------
Buf_4[i]= 0;
MA_11=iMA( NULL, 0, Period_MA_3, 0, MODE_LWMA, PRICE_TYPICAL, i );
for(n=1;n<=Kol_Line;n++)
{
MA_12=iMA( NULL, 0, Period_MA_3, 0, MODE_LWMA, PRICE_TYPICAL, i +Polzun_3[n]);
Line[n]=MA_11-MA_12;
Buf_4[i]=Buf_4[i]+Line[n];
}
Buf_4[i]= K*Buf_4[i]/Kol_Line;
Buf_4[i]=Buf_4[i]*1000;
if (K3==0)Buf_4[i]=0;
//--------------------------------------------------------------------------------------------------------------------
i--;
}
//====================================================================================================================
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
Comments