dex_SCALP
Download scriptThis tool is designed as a visual aid for traders who want to identify potential market momentum and price volatility trends. It works by analyzing historical price data and transforming it into a distinct visual layout in a separate window on your trading platform.
How the Logic Works
The script processes information through a three-step calculation sequence:
1. Smoothing Price Movement First, the tool takes raw price data and applies a smoothing filter over a short period (defined by the "aPeriod" setting). This helps strip away minor market "noise," allowing the indicator to focus on the underlying trend of the asset rather than erratic, second-by-second fluctuations.
2. Calculating the Moving Average The tool then takes those smoothed values and calculates a "Moving Average" over a longer secondary period (defined by "bPeriod"). This creates a base line that represents the general direction of the momentum. By looking at this average, traders can better see whether the current market strength is trending upward, downward, or moving sideways.
3. Establishing the Dynamic Zone Finally, the script calculates the "UpZone." This is done by measuring the volatility (how much the price is swinging) of the smoothed data and applying it to the moving average. It essentially creates a mathematical boundary or "envelope" based on the standard deviation of the current market.
What This Means for the User
Instead of looking at a jagged, complicated price chart, this indicator provides a cleaner representation of market behavior. By displaying both a histogram (representing smoothed data) and a specific line (the UpZone), it helps users visualize:
- Trend Strength: How far the current price is pushing away from its recent average.
- Volatility Limits: Where the "normal" range of price movement ends based on current market conditions.
- Momentum Shifts: Visual cues that suggest when the market is becoming overextended or when it may be returning to its mean.
//+------------------------------------------------------------------+
//| dex_SCALP.mq4 |
//| Copyright © 2004, akadex. |
//| tohell |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, akadex"
#property link "tohell"
#property indicator_buffers 2
#property indicator_color1 SteelBlue
#property indicator_color2 White
#property indicator_separate_window
extern int aPeriod = 5;//EUR 5
extern int bPeriod = 15;//EUR 15
extern double K = 1.0;//EUR 1.0
double RSIBuf[],UpZone[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,RSIBuf);
SetIndexBuffer(1,UpZone);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double MA, RSI[];
ArrayResize(RSI,bPeriod);
int counted_bars=IndicatorCounted();
int limit = Bars-counted_bars-1;
for(int i=limit; i>=0; i--)
{
RSIBuf[i] = iStdDev(NULL,0,aPeriod,MODE_EMA,0,PRICE_MEDIAN,i);
MA = 0;
for(int j=i; j<i+bPeriod; j++) {
RSI[j-i] = RSIBuf[j];
MA += RSIBuf[j]/bPeriod;
}
UpZone[i] = MA + (K * StDev(RSI,bPeriod));
}
//----
return(0);
}
double StDev(double& Data[], int Per)
{
return(MathSqrt(Variance(Data,Per)));
}
double Variance(double& Data[], int Per)
{
double sum, ssum;
for (int i=0; i<Per; i++)
{
sum += Data[i];
ssum += MathPow(Data[i],2);
}
return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+
Comments