Leavitt Projection Indicator for ThinkorSwim


Well-known member
2019 Donor
Im using this its a moving average similar to the hull although I like this better it very responsive to price change.
# Leavitt, Jay A., PhD [2017]. “Beyond The Hull With Leavitt Projections,” Technical Analysis of StockS & commoditieS, Volume 35: February.

script LeavittProjection{
input y = close;
input n = 20;
rec x = x[1] + 1;
def a = (n * sum(x * y, n) - sum(x, n) * sum(y, n) ) / ( n *sum(Sqr(x), n) - Sqr(sum(x, n)));
def b = (sum(Sqr(x), n) * sum(y, n) - sum(x, n) * sum(x *y, n) ) / ( n * sum(Sqr(x), n) - Sqr(sum(x, n)));
plot LeavittProjection= a*x+ b;
script LeavittConvolution
{ input price = close;
input n = 20;
def intLength = Floor(Sqrt(n));
plot LeavittConvolution = LeavittProjection (LeavittProjection (price, n), intLength);
def price = Close;
input length = 9;
def intLength = Floor(Sqrt(length));
plot LeavittConvolution = LeavittProjection (LeavittProjection (price, length), intLength);
LeavittConvolution.AssignValueColor(if LeavittConvolution > LeavittConvolution [1] then Color.GREEN else Color.RED);

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Looked at this a while ago. Decided a SMA of 3 or just the regular candle colors worked better. Then tried different lengths and still could not make it useful for me. Maybe you can display the way you trade this. Always willing to revisit it if can be proven useful.
Using the 3min as the signal of change I can follow the indicator up so far on the 5min and usually all the way up on the 15min or down so I warch the 3,5 and 15min for the fluidity of change.
I'm also using the zero lag Bollinger band as a lower so I watch both indicators
# Zero Lag MACD With Bollinger Bands
# Mobius
# V01.01.2018 Chat Room Request .0.19.2018

declare lower;

input fastLength = 13;
input slowLength = 34;
input MACDLength = 13;
input showBreakoutSignals = yes;

script EMA{
input length = 10;
input price = close;
def K = 2 / (length + 1);
def lag = (length - 1) / 2;
def ZLEMA = K * (2 * price - price[lag]) + (1 - K) * ZLEMA[1];
plot data = ZLEMA;
plot Value = EMA(length = fastLength) - EMA(length = slowLength);
def Avg = EMA(length = MACDLength, price = value);
plot Diff = Value - Avg;
def SD = StDev(Diff, MACDLength);
plot upper = Diff + SD;
plot lower = Diff - SD;
plot ZeroLine = 0;
Value.AssignValueColor(if Value > Value[1]
then color.green
else color.red);

# End Code Zero Lag MACD

Not getting that ZLBB. Think the Ultimate MACD may be more useful. Check out if it works for your plan.
Ill put that on the chart for tomorrow many thanks....

Horserider I like the ultimate macd So to trade it above and below the zero and or bb midline?
@J007RMC So many ways to trade it. Easiest and fastest would be change of MACD colors. The white line is the exp avg of MACD value. So can trade that cross. Blue is the midline of MACD BB can trade that cross. Both can be used as confirmations you are still going in the same direction. For fast trades on 3 min if BBlength is set to 5 That would be first cross. If BBlength is set to 20. The AVG would be first cross. Remember the BBmidline is like a moving average of price. Confused yet ? With the MACD bands acting as Bollinger Bands you can see volatility. With the MACD being inside the bands you can now trade the MACD with the same rules as price and Bollinger bands. So the best setup would be a squeeze of the bands and then getting a breakout with the MACD riding a band up or down. Then the first hint of weakening of that move would be the separation of the MACD from the band. As far as the zero line it can be seen as an indication of the strength or weakness of the MACD, below zero = weaker and above zero = strength. It is extrememly configurable to fit your trading style. Hope that helps.
I'm trying to find an older indicator it's a lower moving avg study and one you wrote last year. The indicator is very good at showing the trend and I recall Tomsk saying one day don't let this indicator fool you, it is a very powerful indicator but I no longer have it?

Ben the levitt projection. But when I load it I get just a straight line?


Found it. The Levitt Projection Indicator I could have used this ****er for the msft retrace.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
347 Online
Create Post

Similar threads

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.