_GSV_Greatest-Swing-Value
Download scriptThis tool is designed to help traders visualize price action dynamics by identifying and measuring "swing values" based on a methodology popularized by Larry Williams. Instead of simply looking at where the price is currently moving, this indicator seeks to quantify the underlying pressure between buyers and sellers over a specific period.
How the Logic Works
Measuring Market Pressure The script analyzes a set number of historical bars (the "Length") to determine two distinct types of momentum:
- Buying Pressure: It calculates the difference between the opening price and the high for each bar, then averages these values. This represents how aggressively the market moved upward from its starting point during that period.
- Selling Pressure: Similarly, it calculates the difference between the opening price and the low for each bar to measure downward movement.
Projecting the Swing Values Once the average buying and selling pressures are established, the script projects two distinct lines on your chart:
- Upper Bound (Blue Line): This is calculated by taking the current opening price and adding a specific multiplier to the average buying pressure. It essentially projects where the price "wants" to go based on upward momentum.
- Lower Bound (Red Line): This is calculated by taking the current opening price and subtracting a specific multiplier from the average selling pressure, showing the projected downside strength.
Multi-Timeframe Analysis
A key feature of this script is its ability to perform "Multi-Timeframe" analysis. This means that even if you are viewing a smaller chart (like a 1-hour chart), the indicator can calculate these swing values based on a larger timeframe (such as the Daily chart). By looking at higher-level data, it helps traders understand the broader market trend without getting distracted by small, insignificant price fluctuations.
Practical Application
The result is a visual "channel" of momentum. When the lines expand, it indicates significant volatility or strong directional pressure. When they contract, it suggests a period of consolidation. By providing these boundaries, the tool helps traders identify potential overextended areas and better understand the structural strength of the current market move.
//+------------------------------------------------------------------+
//| GSV - Greatest Swing Value MTF.mq4 |
//| MT4 code by Max Michael 2021 |
//+------------------------------------------------------------------+
#property description "Larry Williams 'Greatest Swing Value' "
#property description "This price action calculation is from Larry's book"
#property description "Long-Term Secrets to Short-Term Trading"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrBlue
#property indicator_type1 DRAW_LINE
#property indicator_width1 1
#property indicator_color2 clrRed
#property indicator_type2 DRAW_LINE
#property indicator_width2 1
#property strict
extern int Length = 4;
extern double Multiplier = 2.4;
extern ENUM_TIMEFRAMES TimeFrame = PERIOD_D1; // MultiTimeframe (set to Current for normal operation)
extern int MaxBars = 1000;
int updatebars;
double Buffer0[];
double Buffer1[];
int init()
{
SetIndexBuffer(0,Buffer0,INDICATOR_DATA);
SetIndexBuffer(1,Buffer1,INDICATOR_DATA);
int TF=TimeFrame;
if (TF < Period()) TF=Period();
updatebars=MathMax((TF / Period()),1); // example: 1440/240=6 bars to update on H4 chart
return(0);
}
int deinit() { Comment(""); return(0); }
int start()
{
int counted_bars = IndicatorCounted();
if (counted_bars < 0) return(-1);
if (counted_bars > 0) counted_bars--;
int limit = Bars-counted_bars-1;
if (limit > MaxBars) limit=MathMin(MaxBars,limit);
if (limit < updatebars) limit=updatebars;
for(int i=0; i<limit; i++)
{
int d=iBarShift(NULL,TimeFrame,Time[i]);
double GSV_up=0, GSV_dn=0;
for (int n=1; n<=Length; n++)
{
double open=iOpen(_Symbol,TimeFrame,d+n);
double high=iHigh(_Symbol,TimeFrame,d+n);
double low =iLow( _Symbol,TimeFrame,d+n);
GSV_up += high-open; //sum buying pressure
GSV_dn += open-low; //sum selling pressure
}
GSV_up /= (Length); // average
GSV_dn /= (Length);
Buffer0[i]= NormalizeDouble(iOpen(NULL,TimeFrame,d) + Multiplier * GSV_up,_Digits);
Buffer1[i]= NormalizeDouble(iOpen(NULL,TimeFrame,d) - Multiplier * GSV_dn,_Digits);
}
return(0);
}
Comments