Intensivnost_Tikov
Download scriptThis tool is designed to measure and visualize market activity by tracking the frequency of price movements over time. Rather than looking at simple price direction, it quantifies the "intensity" or persistence of market trends by counting how many times the price updates (ticks) during a specific period.
Core Functionality
The script operates by monitoring each individual candle on your trading chart and categorizing them based on three distinct types of price action:
- Bullish Activity: When a candle closes higher than it opened, the tool identifies this as upward movement.
- Bearish Activity: When a candle closes lower than it opened, the tool identifies this as downward movement.
- Neutral Activity: In cases where the opening and closing prices are identical, the tool identifies this as flat or neutral movement.
How the Logic Works
The script functions through a continuous cycle of observation:
- Real-Time Counting: As the market moves, the script keeps a running tally of every "tick" (the smallest unit of price change) that occurs.
- Bar Transition Detection: The script waits for a new candle to form on the chart. At the exact moment a new candle appears, it looks back at the completed candle.
- Data Recording: It assigns the total count of ticks collected during that previous candle to one of three separate visual categories based on whether that candle was Bullish, Bearish, or Neutral.
- Reset Mechanism: Immediately after recording the data for a finished candle, the counter resets to zero to begin measuring the next period accurately.
Visual Representation
The results are displayed in a separate window as three distinct histograms:
- One color represents Bullish intensity.
- A second color represents Bearish intensity.
- A third color represents Neutral intensity.
By viewing these histograms, you can see at a glance which type of momentum is currently dominating the market and how "active" or volatile the price action has been during specific timeframes.
//+------------------------------------------------------------------+
//| Intensivnost_Tikov.mq4 |
//| Copyright © 2007, DRKNN |
//| drknn@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, DRKNN"
#property link "drknn@mail.ru"
#property indicator_separate_window
#property indicator_buffers 3
//Öâåò èíäèêàòîðíûõ ëèíèé
#property indicator_color1 ForestGreen
#property indicator_color2 Crimson
#property indicator_color3 Gray
//Òîëùèíà èíäèêàòîðíûõ ëèíèé
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
// --- Âñïîìîãàòåëüíûå ïåðåìåííûå ----------
int TickCounter=0;//ñ÷¸ò÷èê òèêîâ
int myBars;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start(){
if(isNewBar()==true){//Ïîÿâèëñÿ íîâûé áàð
if(Open[1]<Close[1]){//åñëè áû÷üÿ
ExtMapBuffer1[1]=TickCounter;
TickCounter=0;
}
if(Open[1]>Close[1]){//åñëè ìåäâåæüÿ
ExtMapBuffer2[1]=TickCounter;
TickCounter=0;
}
if(Open[1]==Close[1]){//åñëè äîäæ
ExtMapBuffer3[1]=TickCounter;
TickCounter=0;
}
}
TickCounter++;//íà êàæäîì òèêå óâåëè÷èâàåì ñ÷¸ò÷èê òèêîâ
return(0);
}
//+------------------------------------------------------------------+
// ------- Ïîëüçîâàòåëüñêèå ïîäïðîãðàììû -------------------
//+------------------------------------------------------------------+
//| ôóíêöèÿ isNewBar() - âîçâðàùàåò ïðèçíàê íîâîãî áàðà |
//+------------------------------------------------------------------+
bool isNewBar(){
bool res=false;
if(myBars!=Bars){
res=true;
myBars=Bars;
}
//----
return(res);
}
//---------------------------------------------------------------
Comments