MomoAlphaTrigger (Day to Year) quote for ThinkorSwim

wtf_dude

Active member
No idea if anybody would want this. Built it a year or 2 ago. Yea, some of the letter coding is out of order (I'm not a big coding guy and have severe concentration issues)
Feel free to play around with it.

Add this to your quote screen. It will average the return of the week, month, quarter and year and confirm that it's positive,
Then add the day and the week's returns to add more recent weight and see if the number remains positive,
Then see checks to see if it's beating SPX by more than 25bps,
Then checks to see if the RSI is over 50

If all tests check out, it will give you a green go signal and count the number of days since the signal turned green. Vice versa the tests fail.
Simple, but has helped me a lot with a quick glance for market winners

Code:
# Ultimate MomoAlphaTrigger (Day to Year) by WTF_Dude
# This script identifies days passed since time frame composites are +, alpha is over 25bps, RSI over 50
# if days passed is less than or equal to 5 then we assign light green/red color
# if days passed is greater than or equal to 5 then we assign dark green/red color
# More weight on day and week. Averages week, month, quarter, year.
# Only makes sure the composite is positive. No threshold minimum >0

def price = close;
def f = ((close - close[1]) / close[1]) * 100;
def a = ((close - close[5]) / close[5]) * 100;
def b = ((close - close[21]) / close[21]) * 100;
def c = ((close - close[63]) / close[63]) * 100;
def d = ((close - close[252]) / close[252]) * 100;
def e = ((a + b + c + d) / 4);
def h = f + a + e;

def ALPHA = AlphaJensen(index = "SPX") ;
def RSI1 = RSI(14);

# Identify bars where returns are up
def MOMO1up = e > 0;
def MOMO2up = h > 0;
def ALPHAup = ALPHA>.25;
def RSIup=RSI1>50;

#identify bars for 4up or 4down
def FourUP = MOMO1up and MOMO2up and ALPHAup and RSIup;
def FourDN = !MOMO1up and !MOMO2up and !ALPHAup and !RSIup;
#counter code
def FourUP_Count  = CompoundValue(1, if FourUP != FourUP[1] then 1 else FourUP_Count[1] + 1, 0);
def FourDN_Count  = CompoundValue(1, if FourDN != FourDN[1] then -1 else FourDN_Count[1] + 1 * -1, 0);
def data = if FourUP then FourUP_Count  else if FourDN then FourDN_Count else Double.NaN;
#Assign Back Ground Color

# HINT: Change CreateColor(237,237,237) to Color.BLACK or to any other color that matches your background

AssignBackgroundColor(if FourUP then (if data <= 3 then Color.GREEN else Color.DARK_GREEN ) else if FourDN then (if data >= -3 then Color.RED else Color.DARK_RED) else Color.BLACK );

AddLabel(!IsNaN(data), data, if FourUP then (if data <= 3 then Color.BLACK else Color.WHITE) else if FourDN then (if data >= -3 then Color.WHITE else CreateColor(237, 237, 237)) else Color.BLACK);

AddLabel(IsNaN(data), " ", CreateColor(237, 237, 237));
 

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top