Heikin-Ashi (which is correct?)

Townsend

Active member
VIP
The Heikin Ashi Formula consists of four calculations, which remap Open, Close, High, and Low:
Open = [Open (previous bar) + Close (previous bar)]/2.
Close = (Open+High+Low+Close)/4.
High = Max Price Reached.
Low = Max Low Price Reached.

The chart of the left is the system generated Heikin-Ashi colors.
The chart on the right is the code based Heikin-Ashi colors, derived from the standard formula, as described above.
Notice the difference, highlighted in gray.
pbzpH8q.png


This code will paint the Heikin-Ashi colors on any bar type, including Equivolume.
Code:
def haOpen = (open[1] + close[1])/2;
def haClose = (open + close + high + low)/4;

assignpriceColor(if haOpen < haClose then color.green else
if haOpen > haClose then color.red else color.white);

Which one is correct? Which one is better? Either my code is off, or TOS is using non-traditional inputs?
 
It sounds as if you would like to contrast and compare different scripts?
But that is not possible as you didn't provide any scripts to contrast and compare to.

The standard method for comparing indicators, is to put them on your chart.
Be aware that you will need to extensively play with the settings in order to compare apples-to-apples.

If you are still interested in having a discussion, comparing various scripts.
1. Please post chart images where all the studies are applied.
2. Mark up any confluences that you have questions about.
3. Make sure that you include a shared chart link, so members can see what you are seeing.
How to create a shared chart link:
https://usethinkscript.com/threads/how-to-share-a-chart-in-thinkorswim.14221/


The Heiken Ashi hh hl definitions are used to PLOT the HA candles. As this script does not PLOT the candles, those definitions are not used.
my bad, i had thought there would be an understanding when mentioning Heiken Ashi Candles.
In this post, https://usethinkscript.com/threads/smoothed-heikin-ashi-with-atr-trail-for-thinkorswim.9992/
The script shows a smoothing factor using valcu or vervoort, i was just wondering if there was a difference form the formula on this post vs the one from here or if it was just for smoothing. i may have answered my questions, but any additional thoughts would be helpful. thanks.
 

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
517 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