Daily Gap Formation Watchlist Column for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
This indicator adds a custom column to your watchlist of stocks that show when a gap has formed on the daily chart.
  • Red = Gap down
  • Green = Gap up
  • White = No gap




thinkScript Code

Code:
# Billy Bob's Better Gap Indicator for Column alert
input Detect_Gaps_By = {default "percent", "dollars"};
input Min_Gap_Size = 1.0;

# Define Candle Body
def bodyTop = Max(open, close);
def bodyBottom = Min(open, close);

# Define a gap and its direction
def MinGapSize;
switch (Detect_Gaps_By) {
case "percent":
MinGapSize = Min(close[1] * (Min_Gap_Size/100),5);
case "dollars":
MinGapSize = Min_Gap_Size;
};

def GapUp = bodyBottom - bodyTop[1] >= MinGapSize;
def GapDown = bodyTop - bodyBottom[1] <= -MinGapSize;

plot isGap = if GapUp then 1 else if GapDown then 2 else 0;
isgap.AssignValueColor(if isgap ==1 then color.green else if isgap == 2 then color.red else color.white);

AssignBACKGROUNDColor(if isgap ==1 then color.green else if isgap == 2 then color.red else color.white);

Shareable Link


Credit:
 

Top