To consider the after hour data, it must be on the chart. However, there is a workaround to hide the after hours bars by using the addchart function. Add the code below to hide the price plot and substitute the addchart workaround.
The image shows the workaround in the upper chart without after hours data and the lower chart with the workaround, which shows after hours.
![]()
Then add the following code which will hide the after hours bars
Ruby:def rth = between(gettime(), regularTradingStart(getyyyYMMDD())...
Mod note: see next postIs there any way to make heikin ashi charts consider after hours data without it being displayed? I hate that there are a string of long candles when there is a large gap overnight.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
To consider the after hour data, it must be on the chart. However, there is a workaround to hide the after hours bars by using the addchart function. Add the code below to hide the price plot and substitute the addchart workaround.
The image shows the workaround in the upper chart without after hours data and the lower chart with the workaround, which shows after hours.
![]()
Then add the following code which will hide the after hours bars
Ruby:def rth = between(gettime(), regularTradingStart(getyyyYMMDD()), regularTradingEnd(getyyyYMMDD())); AssignPriceColor(if !rth then Color.BLACK else Color.CURRENT);
![]()
Do you know of anyway to cutout the void that leaves behind? I feel like it will mess up my keltner bands that don't need the after-hours data. Thanks for all your help!Sorry, the above solution did not work as it made the after hours data unusable by hiding the price plot.
So you can try this instead. First go to chart settings and Uncheck Highlight Extended-Hours
Do you know of anyway to cutout the void that leaves behind? I feel like it will mess up my keltner bands that don't need the after-hours data. Thanks for all your help!
That looks like the indicator is using the afterhours data though, I need mine not to use it. It seems the easiest solution would be to somehow change the heikin ashi to where it uses the first normal candle of the day to initialize the trend, avoiding a large gap. Just don't know if that's possible.No, but if you use the solution in post #3, then it should not affect your indicators. See images without and with bars showing in after hours.
That looks like the indicator is using the afterhours data though, I need mine not to use it. It seems the easiest solution would be to somehow change the heikin ashi to where it uses the first normal candle of the day to initialize the trend, avoiding a large gap. Just don't know if that's possible.
Sorry, I should have put photo's in my original post to help explain what I meant. All I'm trying to do is get rid of the long candles on heikin-ashi when a stock gaps up or down.
![]()
![]()
Ruby:input charttype=chartType.CANDLE; def o = open; def h = high; def l = low; def c = close; def HAclose = (o+h+l+c)/4; def HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2, (o[1] + c[1]) / 2); def haopen_ = if haopen>haclose then HAopen + 0 else double.nan; def HAhigh = if haopen_>=haclose then Max(Max(h, HAopen_), HAclose) else double.nan; def HAlow = if haopen>=haclose then Min(Min(l, HAopen_), HAclose) else double.nan; def bar = secondsfromTime(0930) == 0; def o1 = if bar and haopen<haclose then l else double.nan; def c1 = if bar and haopen<haclose then o else double.nan; def h1 = if bar and haopen<haclose then h else double.nan; def l1 = if bar and haopen<haclose then l else double.nan; AddChart(growColor = color.green, fallColor = color.red, neutralColor = color.gray, high = h1, low = l1, open = c1, close = o1, type = chartType); def o2 = if bar and haopen >=haclose then h else double.nan; def h2 = if bar and haopen >=haclose then h else double.nan; def l2 = if bar and haopen >=haclose then halow else double.nan; def c2 = if bar and haopen >=haclose then haclose else double.nan; AddChart(growColor = color.red, fallColor = color.green, neutralColor = color.gray, high = h2, low = l2, open = o2, close = c2, type = chartType); assignpriceColor(if bar then color.black else color.current);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | Heikin ashi diff crossing zero | Questions | 1 | |
O | Heikin Ashi Smoothed Alerts | Questions | 1 | |
Q | Market Confluence Direction - Color Bar Heikin Ashi Trend | Questions | 6 | |
T | Heikin Ashi overlay | Questions | 1 | |
![]() |
Heikin Ashi Calcualtion | Questions | 1 |
Start a new thread and receive assistance from our community.
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.
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.