Gann Hi-lo Activator SSL
Download scriptThis script is designed as a visual aid for traders to identify price trends and potential support or resistance levels on a trading chart. It functions by tracking the relationship between current market prices and specific moving averages based on historical highs and lows.
How the Logic Works
The core objective of this tool is to determine whether the market is currently exhibiting "bullish" (upward) or "bearish" (downward) momentum. It achieves this through a three-step logic process:
1. Trend Detection The script looks at the closing price of each candle and compares it against a moving average of the previous prices.
- If the current price is higher than the moving average of the previous highs, it registers a potential upward trend.
- If the current price is lower than the moving average of the previous lows, it registers a potential downward trend.
2. State Memory Unlike some indicators that change constantly with every tiny price flicker, this script has a "memory" component. Once it detects a shift into an upward or downward trend, it maintains that state until a clear contrary signal occurs. This helps smooth out the visual data, ensuring the indicator doesn't jump back and forth erratically during minor market noise.
3. Visual Plotting Based on the trend identified above, the script draws a continuous line on your chart:
- When the logic identifies a bearish environment, it plots a line based on the recent high prices.
- When the logic identifies a bullish environment, it plots a line based on the recent low prices.
Summary for the User
Essentially, this tool acts as a dynamic "ceiling" or "floor" tracker. It automatically switches between tracking highs and lows to show you where the price is reacting relative to its recent history. By observing the position of the blue line in relation to the current price action, traders can more easily visualize the prevailing momentum of the market at a glance.
//+------------------------------------------------------------------+
//| SSL.mq4 |
//| Kalenzo |
//| bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link "bartlomiej.gorski@gmail.com"
#property indicator_buffers 1
#property indicator_color1 Blue
extern int Lb = 10;
double ssl[],Hld,Hlv;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0,ssl);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
for(int i=Bars-Lb;i>=0;i--)
{
if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1))
Hld = 1;
else
{
if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1))
Hld = -1;
else
Hld = 0;
}
if(Hld!=0)
Hlv = Hld;
if(Hlv == -1)
ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
else
ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments