Haurlan Index For ThinkOrSwim

jpmcewen

Member
VIP
Hi Everyone! I'm sharing an indicator I've scripted in hope that some mathematicians can help in turning the smoothing rules into an equation.

The script appears to work just fine as is (please let me know if you think differently).

I just think that a smoothing equation would allow more flexibility.
I've tried using Excel to create the equation, but it doesn't do a good enough job..

Paul Carroll also talked about using Adv-Dec data instead of closing price of the stock.
More on Haurlan can be read here

Please let me know if you have any thoughts. Enjoy!

J4XupkZ.png


Ruby:
#Haurlan Index
#SOURCE: PN Haurlan - Measuring Trend Values & Paul Carroll - Haurlan Index [TASC]
#Developed by PN Haurlan to measure how far the current price has departed from the trend incorporating adjustments based on Proportional Control (used in missile guidance)
#Book Link: https://www.mcoscillator.com/download/special/McClellan_MTAaward.pdf


input lenShort = 5; #HINT lenShort: select a stabilization period between 1-10
input lenMedium = 20; #HINT lenMedium: select a stabilization period between 11-20
input lenLong = 200; #HINT lenLong: select a stabilization period between 21-200

script tr {
input len = 0;
def rate = if Between(len, 1, 4) then 1.00 else if
  Between(len, 5, 9) then 0.50 else if
  Between(len, 10, 11) then 0.25 else if
  Between(len, 12, 19) then 0.20 else if
  Between(len, 20, 44) then 0.10 else if
  Between(len, 45, 99) then 0.05 else if
  Between(len, 100, 199) then 0.02 else if
  len == 200 then 0.01 else 0.00;

plot rateTracking = rate;
}

def C = close;
def trackShort = tr(lenShort); #tracking rate
def trackMedium = tr(lenMedium); #tracking rate
def trackLong = tr(lenLong); #tracking rate

def trendShort = if !isNan(trendShort[1]) then trendShort[1] + ((C - trendShort[1]) * trackShort) else Double.NaN;
def trendMedium = if !isNan(trendMedium[1]) then trendMedium[1] + ((C - trendMedium[1]) * trackMedium) else Double.NaN;
def trendLong = if !isNan(trendLong[1]) then trendLong[1] + ((C - trendLong[1]) * trackLong) else Double.NaN;

plot haurlanShort = trendShort;
plot haurlanMedium = trendMedium;
plot haurlanLong = trendLong;
 
Last edited by a moderator:
mod note:
  • Blue EMA (Long-Term) → This is the big picture. It shows the overall trend. Trades against trend have more risk.
  • Pink EMA (Intermediate-Term) → This is your signal line. When price crosses, it could mean a shift is coming. Check your other indicators. If things align, it might be time to jump in—maybe even against the long-term trend, if conditions are right.
 
Last edited by a moderator:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
537 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.
Back
Top