OPEN-SOURCE SCRIPT

SCE GANN Predictions

949
This is a script designed to give an insight on price direction from being above or below a GANN Value.

What Are GANN Waves?
The SCE GANN Predictions indicator is inspired by the work of W.D. Gann, a renowned trader who believed that price movements follow geometric and mathematical patterns. GANN waves use past price behavior—specifically momentum or "velocity"—to forecast where prices might head next.

How Does the Indicator Work?

Calculating Velocity

The script starts by measuring the "velocity" of price movement over a user-defined lookback period (denoted as n). This velocity is the average difference between the close and open prices over n bars. Think of it as the market’s speed in a given direction.

Predicting the Future Price

Using this velocity, the indicator estimates a future price after a specific time horizon—calculated as n + n*2 bars into the future (e.g., if n = 15, it predicts 45 bars ahead). It scales the velocity by a ratio (Gr) to determine the "end price." This is the raw GANN prediction.

Optimizing the Ratio (Gr)

The key to a good prediction is finding the right Gr. The script tests a range of Gr values (from Gr_min to Gr_max, stepping by Gr_step) and evaluates each one by calculating the sum of squared errors (SSE) between the predicted prices and the actual historical close prices. The Gr with the lowest SSE is deemed "optimal" and used for the final prediction.

Smoothing with an SMA

The raw GANN prediction is then smoothed using a simple moving average (SMA) over the lookback period (n). This SMA is plotted on your chart, serving as a dynamic trend line. The plot’s color changes based on the current price: teal if the close is above the SMA (bullish), and red if below (bearish).

Visuals

istantanea

This example shows how the value explains price strength and changes color. When the price is above the line, and it’s green, we’re showing an up trend. The opposite is when the price is below the line, and it’s red, showing a down trend.
We can see that there may be moments where price drops under the value for just that one bar.

istantanea

In scenarios with sideways price action, even though the price crosses, there is no follow through. This is a shortcoming of the overall concept.

Customizable Inputs

Timeframe: Choose the timeframe for analysis (default is 2 minutes).
Show GANN Wave: Toggle the GANN SMA plot on or off (default is true).
Lookback Period (Gn): Set the number of bars for velocity and SMA calculations (default is 15).
Min Ratio (Gr_min): The lower bound for the Gr optimization (default is 0.05).
Max Ratio (Gr_max): The upper bound for Gr (default is 0.2).
Step for Gr (Gr_step): The increment for testing Gr values (default is 0.01).

How to Use SCE GANN Predictions

Trend Direction
The colored SMA provides a quick visual cue. Teal suggests an uptrend, while red hints at a downtrend. Use this to align your trades with the broader momentum.

Crossover Signals

Watch for the close price crossing the GANN SMA. A move above could signal a buy opportunity, while a drop below might indicate a sell. Combine this with other indicators for confirmation.

Fine-Tuning
Experiment with the lookback period (Gn) and Gr range to optimize for your market. Shorter lookbacks might suit fast-moving assets, while longer ones could work for slower trends.

Like any technical tool, SCE GANN Predictions isn’t a crystal ball. It’s based on historical data and mathematical assumptions, so it won’t always be spot-on.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.