This tool is designed to help traders visualize the distribution of momentum within a specific timeframe. Instead of showing you exactly where the price is moving at this very second, it analyzes a recent block of history to show you "where" the market has been spending most of its energy.
How it Works
The logic operates by looking back at a specific number of candles (which you can customize) and examining the Stochastic Oscillator values for each of those candles.
Rather than just plotting a line that goes up and down, the script performs a "frequency count." It looks at every individual candle in that recent history, calculates its momentum score, and then counts how many times that specific score appeared.
The Visual Output
The result is displayed as a histogram or a distribution map. Here is how to interpret what it shows:
- Frequency Mapping: The indicator creates a scale (from 0 to 100). If the market momentum was frequently in the "overbought" zone (near the top of the scale), you will see a higher concentration of data points on the right side of the visual window.
- Market Density: If the majority of the counts are clustered in the middle, it suggests the market is moving sideways or lacks a strong trend.
- Trend Confirmation: High clusters at either extreme ends indicate that the price has been consistently staying in those zones for a significant portion of the recent history.
Summary for the User
Essentially, this script acts like a "Heat Map" for momentum. It tells you how often the market has reached certain levels recently, helping you see if the current price action is part of a common behavior or an unusual outlier compared to the most recent history provided by your settings.
//+------------------------------------------------------------------+
//| PDF.mq4 |
//| Copyright © 2006, Luis Guilherme Damiani |
//| http://www.damianifx.com.br |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Luis Guilherme Damiani"
#property link "http://www.damianifx.com.br"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 MediumSeaGreen
double pdf[];
//---- input parameters
extern int ch_size=20;
//extern int limit_value=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,pdf);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
//---- indicators
int counter[100];
int totBars=Bars;
int value=0;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
ArrayInitialize(counter,0);
for(int i =Bars-1-ch_size;i>=0;i--)
{
value=MathCeil(iStochastic(NULL,0,ch_size, 2,1,MODE_SMA,0,MODE_MAIN,i));
counter[100-value]=counter[100-value]+1;
//if(counter[100-value]>limit_value && limit_value!=0)counter[100-value]=limit_value;
}
pdf[0]=0;
for(i=100;i>0;i--)
{
pdf[i]=counter[i];
// Print(pdf[i]);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments