Created
October 30, 2021 15:57
-
-
Save gavstah/37868be9af5eb07bdd6b72c9ae920881 to your computer and use it in GitHub Desktop.
TOS Squeeze Play
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Hint: SqueezePlay - stacked EMAs (8,21,34,55,89), Upward momentum on TTM_Squeeze, in a squeeze, and price over the 21 EMA | |
input price = close; | |
# define the EMAs | |
def ema8 = ExpAverage(price, 8); | |
def ema21 = ExpAverage(price, 21); | |
def ema34 = ExpAverage(price, 34); | |
def ema55 = ExpAverage(price, 55); | |
def ema89 = ExpAverage(price, 89); | |
# plot the EMAs | |
plot EMA8_ = ExpAverage(price, 8); | |
plot EMA21_ = ExpAverage(price, 21); | |
plot EMA34_ = ExpAverage (price, 34); | |
plot EMA55_ = ExpAverage (price, 55); | |
plot EMA89_ = ExpAverage (price, 89); | |
# is the price in the buy zone? | |
def buyZone = price < EMA8 AND price > EMA21; | |
# now, let's see what we have | |
# 1) is momentum > 0 and on an upward trend on then TTM_Squeeze() histogram? | |
def bullMomentum = TTM_Squeeze().Histogram > 0 && TTM_Squeeze().Histogram > TTM_Squeeze().Histogram[1]; | |
# 2) Has the price closed over the 21 EMA? | |
def closeOver21 = price > EMA21_; | |
# 3) Are EMAs stacked in acsending order ("The Royal Setup")? | |
def stackedEMAS = EMA8_ > EMA21_ AND EMA21_ > EMA34_ AND EMA34 > EMA55_ AND EMA55_ > EMA89; | |
# 4) are we in a TTM_squeeze (true if squeezealert has not fired)? | |
def squeeze = !TTM_Squeeze().SqueezeAlert; | |
# do we have a squeeze play? | |
def squeezePlay = squeeze && stackedEMAS && bullMomentum && closeOver21; | |
# set the stacked label | |
AddLabel(price, ”Stacked EMAs” , (if stackedEMAS then Color.GREEN else Color.RED)); | |
# set clean squeeze label if we're in a clean squeeze | |
AddLabel(if squeezePlay then yes else no, " Squeeze Play ", Color.GREEN); | |
# Add buy zone label if we're in the buy zone | |
AddLabel(if buyZone then yes else no, "BUY ZONE", Color.GREEN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment