Ind-GG01
Download scriptThe Ind-GG01 script is a technical analysis tool designed to identify specific market trends and potential entry points by monitoring the relationship between several different price indicators simultaneously. Instead of relying on a single metric, the logic synthesizes data from moving averages, volatility bands, and momentum oscillators to filter out noise and highlight significant movements.
Core Components of the Logic
To determine its signals, the script continuously analyzes four primary technical components:
- Moving Averages: It tracks the current "smoothed" price average and compares it against a secondary custom calculation to identify the underlying direction of the market.
- Parabolic SAR: This is used as a trend-following filter. The script checks whether the current price is above or below this specific trajectory point to confirm if the momentum is moving in the desired direction.
- Bollinger Bands & Volatility: The tool measures the "spread" or distance between the upper and lower Bollinger Bands. It specifically looks for instances where this volatility exceeds a certain threshold, ensuring that signals are only generated during periods of significant market activity.
- Momentum Acceleration: By comparing the current volatility spread to the previous candle's spread, the script confirms whether the market intensity is expanding or contracting.
How Signals Are Generated
The script looks for a unique "confluence" of events where all conditions must be met at once:
For Sell Signals: A signal is triggered when the price averages are trending downward (showing weakness), the Parabolic SAR suggests a bearish trend, and the market volatility is both high enough to be significant and actively increasing. When these factors align, a specific visual marker is placed on the chart.
For Buy Signals: Conversely, a buy signal appears when the price averages show upward strength, the Parabolic SAR confirms bullish momentum, and the market volatility is meeting the required minimum intensity while continuing to expand.
Neutral Trend Tracking: In instances where neither a specific Buy nor Sell condition is met, the script provides a continuous line representing the base moving average. This allows the user to see the "median" path of the price while waiting for the specific high-volatility conditions required to trigger a signal.
Summary of Behavior
Essentially, this script acts as a sophisticated filter. It ignores "flat" or sideways markets by requiring a minimum expansion of volatility (the Bollinger Band difference). It then confirms the direction of that movement using moving averages and trend oscillators, providing the user with clear visual markers when high-momentum trends are confirmed.
//+------------------------------------------------------------------+
//| Ind-GG01.mq4 |
//| GGekko |
//| |
//+------------------------------------------------------------------+
#property copyright "GGekko"
#property link ""
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Gold
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ma0,ma1;
double ca;
double psar;
double boll_upper0,boll_upper1;
double boll_lower0,boll_lower1;
double bollingerdiff0,bollingerdiff1;
int barsToProcess=500;
extern int period_ma=5;
extern int period_ca=5;
extern int method_=MODE_SMMA;
extern int price_=PRICE_CLOSE;
extern double step_psar=0.01;
extern double max_psar=0.3;
extern int period_boll=14;
extern int dev_boll=2;
extern int bolldiff=15;
/*
PRICE_CLOSE 0 Close price.
PRICE_OPEN 1 Open price.
PRICE_HIGH 2 High price.
PRICE_LOW 3 Low price.
PRICE_MEDIAN 4 Median price, (high+low)/2.
PRICE_TYPICAL 5 Typical price, (high+low+close)/3.
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.
MODE_SMA 0 Simple moving average,
MODE_EMA 1 Exponential moving average,
MODE_SMMA 2 Smoothed moving average,
MODE_LWMA 3 Linear weighted moving average.
*/
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,242);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,241);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,115);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,EMPTY_VALUE);
IndicatorShortName("GG01 ("+period_ma+","+period_ca+","+bolldiff+")");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(), limit;
int i=0;
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
if(limit>barsToProcess)
limit=barsToProcess;
while (i<limit)
{
ma0=iMA(NULL,0,period_ma,0,method_,price_,i);
ma1=iMA(NULL,0,period_ma,0,method_,price_,i+1);
ca=iCustom(NULL,0,"i-CAi",period_ca,method_,price_,0,i);
psar=iSAR(NULL,0,step_psar,max_psar,i);
boll_lower0=iBands(NULL,0,period_boll,dev_boll,0,PRICE_CLOSE,MODE_LOWER,i);
boll_upper0=iBands(NULL,0,period_boll,dev_boll,0,PRICE_CLOSE,MODE_UPPER,i);
bollingerdiff0=(boll_upper0-boll_lower0)/Point;
boll_lower1=iBands(NULL,0,period_boll,dev_boll,0,PRICE_CLOSE,MODE_LOWER,i+1);
boll_upper1=iBands(NULL,0,period_boll,dev_boll,0,PRICE_CLOSE,MODE_UPPER,i+1);
bollingerdiff1=(boll_upper1-boll_lower1)/Point;
//SELL SIGNAL
if(ma0<ca && ma0<=ma1 && psar>Close[i] && bollingerdiff0>bolldiff && bollingerdiff0>bollingerdiff1)
ExtMapBuffer1[i]=ma0;
else ExtMapBuffer1[i]=EMPTY_VALUE;
//BUY SIGNAL
if(ma0>ca && ma0>=ma1 && psar<Close[i] && bollingerdiff0>bolldiff && bollingerdiff0>bollingerdiff1)
ExtMapBuffer2[i]=ma0;
else ExtMapBuffer2[i]=EMPTY_VALUE;
if(ExtMapBuffer1[i]==EMPTY_VALUE && ExtMapBuffer2[i]==EMPTY_VALUE)
ExtMapBuffer3[i]=ma0;
else ExtMapBuffer3[i]=EMPTY_VALUE;
i++;
}
Comment("GG01 ("+period_ma+","+period_ca+","+bolldiff+")");
//----
return(0);
}
//+------------------------------------------------------------------+
Comments