_2523NBS Juice
Download scriptThis script functions as a visual volatility and momentum tracker designed to categorize market activity into three distinct quality levels. Instead of just showing raw price movement, it evaluates the "strength" of current market behavior by comparing recent fluctuations against historical averages.
Core Logic Overview
The indicator works by measuring market volatility—specifically how much prices are swinging away from their average—over a specific period. It then takes these measurements and categorizes them into three different "states," which are displayed on your chart as colored bars and reference lines.
How the Analysis Works
- Baseline Establishment: The script looks back at a set number of previous candles to calculate a baseline of normal market volatility. This creates an "average" expectation of how much the price typically moves during normal trading conditions.
- Dynamic Comparison: It then takes the current market movement and compares it against that historical average.
- The Three-Tier Classification: Based on this comparison, the script sorts every price movement into one of three categories:
- High Strength (Good): When current volatility is significantly higher than the established threshold (determined by a user-defined multiplier), it identifies a high-intensity move.
- Moderate Strength (So-So): When movement falls between the average and the high-strength threshold, it marks the period as moderate activity.
- Low Strength (Bad): When volatility is lower than the established average, it indicates a period of low energy or consolidation.
Visual Representation
To make this data easy to read at a glance:
- Histogram Bars: The script paints different colored bars based on which category the current market activity falls into. This allows you to immediately see if the market is currently in a high-intensity, moderate, or low-volatility state.
- Reference Lines: The indicator plots two dotted lines on the chart. These serve as your visual "measuring sticks"—one representing the standard average and the other representing the high-strength threshold. By looking at where the bars sit in relation to these lines, you can quickly gauge the intensity of the current trend.
Summary for the Trader
Essentially, this tool filters out the noise of the market to show you the "quality" of the price action. It helps identify when the market is moving with significant force (High Strength) versus when it is merely drifting or idling (Low Strength), allowing for a clearer understanding of current market momentum.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Juice.mq4 |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Olive
#property indicator_color2 FireBrick
#property indicator_color3 Orange
#property indicator_color4 Pink
#property indicator_color5 Magenta
//---- indicator parameters
extern int Length=7;
extern double Ks=1.5; //multiplier times avg of stdev over the # of CalcBars
extern int CalcBars=96; //put zero if want to calculate on all bars
extern int Advance = 70;
//---- indicator buffers
//---- indicator buffers
double GoodJuice[];
double SoSoJuice[];
double BadJuice[];
double SoSoLine[];
double GoodLine[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT,1);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT,1);
//---- indicator buffers mapping
SetIndexBuffer(0,GoodJuice);
SetIndexBuffer(1,SoSoJuice);
SetIndexBuffer(2,BadJuice);
SetIndexBuffer(3,SoSoLine);
SetIndexBuffer(4,GoodLine);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Juice mod v1 ("+Length+","+Ks+")");
SetIndexShift (1, Advance);
//---- initialization done
SetIndexEmptyValue(0,0);
SetIndexEmptyValue(1,0);
SetIndexEmptyValue(2,0);
SetIndexEmptyValue(3,0);
SetIndexEmptyValue(4,0);
return(0);
}
//+------------------------------------------------------------------+
//| Juice_mod_v1.2 |
//+------------------------------------------------------------------+
int start()
{
int i;
//---- main loop
double sum=0;
if (CalcBars==0) int NBars=Bars-Length; else NBars=CalcBars;
for(i=1; i<=NBars; i++) sum+=iStdDev(NULL,0,Length,MODE_LWMA,0,PRICE_CLOSE,i);
double avg=sum/NBars;
for(i=Bars-Length-1; i>=0; i--)
{
double Juice=iStdDev(NULL,0,Length,MODE_LWMA,0,PRICE_CLOSE,i);
SoSoLine[i]=avg/Point;
GoodLine[i]=(Ks*avg)/Point;
if((Juice/Point)>=GoodLine[i]){
GoodJuice[i]=Juice/Point;
BadJuice[i]=0;
SoSoJuice[i]=0;
}
if((Juice/Point)<GoodLine[i] && (Juice/Point)>=SoSoLine[i]){
GoodJuice[i]=0;
BadJuice[i]=0;
SoSoJuice[i]=Juice/Point;
}
if((Juice/Point)<SoSoLine[i]){
GoodJuice[i]=0;
BadJuice[i]=Juice/Point;
SoSoJuice[i]=0;
}
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
Comments