Scan for Dead Cat Bounce in ThinkorSwim

luicius

New member
Is it possible to create a scan for dead cat bounces or how some traders call it as the "h pattern"?

QYr34pK.jpg


This is an example of a Futures contract /HG on 1/11/2021 between the hours of 6PM EST and 9PM EST - Please know this works on regular stocks as well.
The Yellow line is the VWAP.

Here is another example

AT9xurN.png


This is how the Dead Cat bounce is defined: https://www.investopedia.com/terms/d/deadcatbounce.asp

I've been dabbling with some code but have not had much success.

Code:
declare lower;
input length = 5;

def IsLongBlack = IsLongBlack(length);

def myVWAP = reference VWAP()."VWAP";
def underVWAP = high < myVWAP;

def redCandles = sum(close < open, 2) >=2;
def lowerLows = sum(high < high[1] && low < low[1] ,2) >= 2;

plot scan = underVWAP and (redCandles or redCandles[1]) and
            (lowerLows or lowerLows[1]) and IsLongBlack;

Here I am defining what may be what's marked as B in the image above. What I am having difficulty coding is the condition between B and C.

There may be a better way of accomplishing this. Any help will be greatly appreciated.
 

XeoNoX

Well-known member
VIP
if condition is higher than C and lower and B then true else false
Code:
def istrue = if ((condition > C) and (condition < B)) then 1 else 0;
 

XeoNoX

Well-known member
VIP
Whoops, @luicius here is corrected, I forgot to cover the other possibility:

#if condition is higher than C and condition is lower than B OR condition is lower than C and condition is higher than B then true else false

Code:
#Code:
def istrue = if ((condition > C) and (condition < B)) or  ((condition <  C) and (condition > B)) then 1 else 0;
 

Similar threads

Top