3in1 Gap Meter

Category: Indicators By: juanj Created: April 8, 2018, 12:32 PM
April 8, 2018, 12:32 PM
Indicators
0 Comments

This indicator provides a way to track 3 different types of Gaps along with actively tracking how far away the price is from closing them. Open gaps to the upside are represented as positive bars and gaps to the downside as negative bars.

The Gap types are as follow:

  1. Daily Gaps – Unclosed range between market closing price and market open price
  2. Intraday Gaps – Unclosed range between the top and bottom shadows of two consecutive candles
  3. Brooks Gaps – Unclosed range between the top and bottom of every second candle

The gap type can be manually switched using the GapType parameter.

The code looks as follow:

//Gap Type as Variable

If GapType = 1 Then //Daily

SGap = 0
LGap = 0

If hour = 17 and minute = 0 Then
GapClose = close
ElsIf hour = 9 and minute = 0 then
If low > GapClose Then
Gap = (low-GapClose)* -1
ElsIf high < GapClose Then
Gap = (GapClose-high) * +1
EndIf
ElsIf hour >= 9 and hour < 17 Then
If Gap > 0 Then
Gap = (GapClose-high) * +1
ElsIf Gap < 0 Then
Gap = (low-GapClose) * -1
EndIf
Else
Gap = 0
EndIf

ElsIf GapType = 2 Then //Intraday

Gap = 0

Once SGap = 0
Once LGap = 0

If hour < 9 or hour >= 22 Then
SGap = 0
LGap = 0
Else

If SGap = 0 and low - high[1] > 0.0001 THEN
SGapClose = high[1]
SGap = (low-SGapClose) * -1
EndIf
If LGap = 0 and low[1] - high > 0.0001 THEN
LGapClose = low[1]
LGap = (LGapClose-High) * +1
ENDIF

If SGap < 0 Then
If (low-SGapClose) * -1 > 0 Then
SGap = 0
Else
SGap = (low-SGapClose) * -1
EndIf
EndIf
If LGap > 0 Then
If (LGapClose-High) < 0 Then
LGap = 0
Else
LGap = (LGapClose-High) * +1
EndIf
EndIf

EndIf

ElsIf GapType = 3 Then //Brooks Gap

Gap = 0

Once SGap = 0
Once LGap = 0

If hour < 9 or hour >= 22 Then
SGap = 0
LGap = 0
Else

If SGap = 0 and low - high[2] > 0.0001 THEN
SGapClose = high[2]
SGap = (low-SGapClose) * -1
EndIf
If LGap = 0 and low[2] - high > 0.0001 THEN
LGapClose = low[2]
LGap = (LGapClose-High) * +1
ENDIF

If SGap < 0 Then
If (low-SGapClose) * -1 > 0 Then
SGap = 0
Else
SGap = (low-SGapClose) * -1
EndIf
EndIf
If LGap > 0 Then
If (LGapClose-High) < 0 Then
LGap = 0
Else
LGap = (LGapClose-High) * +1
EndIf
EndIf

EndIf

EndIf

return Gap style(HISTOGRAM) as "GAP", SGap style(HISTOGRAM) as "Short GAP", LGap style(HISTOGRAM) as "Long GAP", 0 as "zero"

Download
Filename: 3in1-Gap-Meter.itf
Downloads: 200
juanj Master
My name is Juan Jacobs and I am an algorithmic trader and trading coach. After 7 years of corporate work as a Systems Analyst, I have decided to pursue my passion of trading on a full-time basis. My current focus area is that of 'smart' strategies based on 'Machine Learning'. You can find me at www.FXautomate.com or visit my PRC Marketplace Store here: https://market.prorealcode.com/store/fxautomate/
Author’s Profile

Comments

Logo Logo
Loading...