Priliv_sw
Download scriptThis script is a specialized technical analysis tool designed to visualize market momentum by calculating and displaying the "velocity" of price trends across different timeframes. Instead of showing simple price movements, it focuses on how fast a trend is accelerating or decelerating.
Core Logic Overview
The indicator operates by comparing moving averages (the smoothed average price) against themselves at slightly different historical points. By calculating the difference between these values, the script determines the speed of the current trend.
It provides three distinct visual layers of data:
- Current Timeframe Velocity: Shows how fast the price is moving on your current chart settings.
- Next Higher Timeframe Velocity: Projects the trend speed for the next logical higher timeframe (e.g., if you are viewing a 5-minute chart, it calculates the velocity for a 15-minute window).
- Subsequent Timeframe Velocity: Projects the trend speed for the even larger timeframe beyond that (e.g., moving from a 15-minute view toward a 60-minute view).
Key Features and Behavior
- Dynamic Adaptation: The script is programmed to automatically adjust its internal calculations based on the specific timeframe you are currently viewing. It recognizes common trading periods (like 1, 5, 15, 30, 60, and 240 minutes) and reconfigures its math to ensure the data remains relevant to that specific scale.
- Trend Change Identification: A primary use for this logic is identifying "turns." When the lines displayed by the script change direction or slope significantly, it serves as a signal that the underlying trend may be shifting.
- Visual Output: The data is plotted in a separate window below your main price chart. This allows traders to monitor the "momentum" of the market independently of the price candles.
How to Interpret the Data
The primary objective of this logic is to help a trader see what is happening "beyond" the current screen. While the price might look stable on a small timeframe, these velocity lines can reveal if a larger trend is beginning to pick up speed or lose steam. By monitoring the relationship between the current velocity and the higher-timeframe velocities, a trader can better anticipate major market moves before they fully manifest on the smaller chart.
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
// 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 CornflowerBlue
#property indicator_color2 Orange
#property indicator_color3 Red
#property indicator_color4 Magenta
#property indicator_style1 2
#property indicator_style2 0
#property indicator_style3 2
#property indicator_style4 4
//--------------------------------------------------------------------------------------------------------------------
extern int CountBars=2000;
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);
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (1,DRAW_LINE);
SetIndexBuffer(1,Buf_2);
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (2,DRAW_LINE);
SetIndexBuffer(2,Buf_3);
//--------------------------------------------------------------------------------------------------------------------
SetIndexStyle (3,DRAW_LINE);
SetIndexBuffer(3,Buf_4);
//--------------------------------------------------------------------------------------------------------------------
SetIndexLabel(0,"baseMA");
SetIndexLabel(1,"VelCurrTF");
SetIndexLabel(2,"VelNextTF");
SetIndexLabel(3,"VelTFafterNext");
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--;
}
//====================================================================================================================
for (int i=0;i<=indicator_buffers;i++) SetIndexDrawBegin(i, Bars-CountBars-Period_MA_1*K2);//CountBars
return(0);
}
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
int deinit()
{
return(0);
}
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
Comments