https://usethinkscript.com/threads/heiken-ashi-scan.7501/Is it possible to make my scan run scans for Heiken Ashi candles? thanks
You could try to modify this script which identifies the wicks and tails:Here is the scan code for this indicator... I recommend saving two separate scans, one for Longs and one for Shorts... I have tested against my main Watchlist using various timeframes with successful results... Enjoy...
UPDATES:
# v1.0 : 2021-08-13 : Initial release.
# v1.1 : 2021-08-17 : Added ability to scan for "unconfirmed" (Yellow) signals.
# v1.2 : 2021-08-25 : Fixed logic for proper scan results and added more usage comments.
Love all the support you have given on the Hiekin Ashi Scanning. I do have a question/request. I am using the scan above and wanted to know if it could be amended to only show in the results the underlying stocks whose last candle did not have a tail if they are an Green Candle or a wick if they are a Red Candle? Also, can you set this up to only display Yellow Candles if they have a wick or a tail, but not both. Looking for candles that are more decisive. Thank you!
TOS Mobile AppIs there a way to have this indicator show up on TOS mobile app? I have it on my computer ok but on the app it shows up as solid purple line?
Thanks
I should have been more specific. Im talking about the indicator code in Post #9.
I will check those indicators out Thanks.TOS Mobile App
The TOS built-in mobile indicators work on the TOS mobile app.
ToS Mobile does not support custom indicators that utilize vertical lines, labels, bubbles, clouds, "color changes for slopes and lines", renko, or multiple timeframes.
Here are some workarounds --> https://usethinkscript.com/threads/indicators-not-working-in-thinkorswim-mobile-app.232/
Here are some ToS Mobile Friendly Indicators --> https://usethinkscript.com/threads/tos-mobile-friendly-indicators.1071/
Here is the Heikin_Ashi_Trend_Dashboard which can be added to charts to show the Heikin Ashi trend reversals... It also contains code for potential trend reversal alerts based on the yellow bars, includes colorbar code to color the chart candles, and the dashboard can also be disabled...
UPDATES:
# v1.0 : 2021-08-17 : Initial release
# v1.1 : 2021-08-18 : Modified to 10 bars from 5
# v1.2 : 2021-08-27 : Added option to hide Dashboard
Ruby:# Heikin_Ashi_Trend_Dashboard # Paints Yellow bar to signal potential trend reversals while Green and Red bars indicate trend direction. # Optionally sounds alerts on trend reversal while eliminating most false signals. # Optionally paints candles based on HA trend # Created by rad14733 for usethinkscript.com # v1.0 : 2021-08-17 : Initial release # v1.1 : 2021-08-18 : Modified to 10 bars from 5 # v1.2 : 2021-08-27 : Added option to hide Dashboard input useAlerts = no; input alertType = Alert.BAR; input buySound = Sound.DING; input sellSound = Sound.BELL; input colorBars = no; input hideDashboard = no; def haClose = ohlc4; def haOpen = (haOpen[1] + haClose[1]) / 2; def haTrendUp = if haClose >= haOpen then 1 else 0; def haTrendDn = if haClose < haOpen then 1 else 0; def haSignal = if haTrendUp == 1 and haTrendUp[1] == 1 then 1 else if haTrendDn == 1 and haTrendDn[1] == 1 then -1 else 0 ; DefineGlobalColor("Label", Color.ORANGE); DefineGlobalColor("UpTrend", Color.GREEN); DefineGlobalColor("DnTrend", Color.RED); DefineGlobalColor("Transition", Color.YELLOW); AddLabel(!hideDashboard, "HA Trend:", GlobalColor("Label")); AddLabel(!hideDashboard, " ", if haSignal[9] == 1 then GlobalColor("UpTrend") else if haSignal[9] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[8] == 1 then GlobalColor("UpTrend") else if haSignal[8] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[7] == 1 then GlobalColor("UpTrend") else if haSignal[7] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[6] == 1 then GlobalColor("UpTrend") else if haSignal[6] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[5] == 1 then GlobalColor("UpTrend") else if haSignal[5] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[4] == 1 then GlobalColor("UpTrend") else if haSignal[4] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[3] == 1 then GlobalColor("UpTrend") else if haSignal[3] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[2] == 1 then GlobalColor("UpTrend") else if haSignal[2] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[1] == 1 then GlobalColor("UpTrend") else if haSignal[1] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal == 1 then GlobalColor("UpTrend") else if haSignal == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); Alert(useAlerts and haSignal[1] == 0 and haSignal == 1, "HA Buy Signal", alertType, buySound); Alert(useAlerts and haSignal[1] == 0 and haSignal == -1, "HA Sell Signal", alertType, sellSound); AssignPriceColor(if colorBars then if haSignal == 1 then GlobalColor("UpTrend") else if haSignal == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") else Color.CURRENT ); # END - Heikin_Ashi_Trend_Dashboard
I edited the original code (see lines 7 and 9 below). I'm halfway there, as it's now locked into SPY like I want. However, I still can't get the aggregation locked in, despite adding "input aggregationPeriod = AggregationPeriod.HOUR;". It still changes to whatever the current timeframe is on my charts.I'm looking to have this same label, but I'd like it to be specifically for SPY with the aggregation set at 1-Hr. My goal is to have it on different charts with different timeframes, but always displaying the Heikin Ashi trend for SPY at the 1-Hr time frame. Thanks for any help!
input useAlerts = no;
input alertType = Alert.BAR;
input buySound = Sound.DING;
input sellSound = Sound.BELL;
input colorBars = no;
input hideDashboard = no;
input aggregationPeriod = AggregationPeriod.HOUR;
def haClose = ohlc4 ("SPY");
def haOpen = (haOpen[1] + haClose[1]) / 2;
def haTrendUp = if haClose >= haOpen then 1 else 0;
def haTrendDn = if haClose < haOpen then 1 else 0;
def haSignal =
if haTrendUp == 1 and haTrendUp[1] == 1 then 1
else if haTrendDn == 1 and haTrendDn[1] == 1 then -1
else 0
;
DefineGlobalColor("Label", Color.ORANGE);
DefineGlobalColor("UpTrend", Color.GREEN);
DefineGlobalColor("DnTrend", Color.RED);
DefineGlobalColor("Transition", Color.YELLOW);
AddLabel(!hideDashboard, "HA Trend:", GlobalColor("Label"));
AddLabel(!hideDashboard, " ",
if haSignal[9] == 1 then GlobalColor("UpTrend")
else if haSignal[9] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[8] == 1 then GlobalColor("UpTrend")
else if haSignal[8] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[7] == 1 then GlobalColor("UpTrend")
else if haSignal[7] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[6] == 1 then GlobalColor("UpTrend")
else if haSignal[6] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[5] == 1 then GlobalColor("UpTrend")
else if haSignal[5] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[4] == 1 then GlobalColor("UpTrend")
else if haSignal[4] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[3] == 1 then GlobalColor("UpTrend")
else if haSignal[3] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[2] == 1 then GlobalColor("UpTrend")
else if haSignal[2] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal[1] == 1 then GlobalColor("UpTrend")
else if haSignal[1] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
AddLabel(!hideDashboard, " ",
if haSignal == 1 then GlobalColor("UpTrend")
else if haSignal == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
);
Alert(useAlerts and haSignal[1] == 0 and haSignal == 1, "HA Buy Signal", alertType, buySound);
Alert(useAlerts and haSignal[1] == 0 and haSignal == -1, "HA Sell Signal", alertType, sellSound);
AssignPriceColor(if colorBars then
if haSignal == 1 then GlobalColor("UpTrend")
else if haSignal == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition")
else Color.CURRENT
);
All of your calculations need to make use of the aggregation period selected, especially those Heikin Ashi ohlc calculations...I edited the original code (see lines 7 and 9 below). I'm halfway there, as it's now locked into SPY like I want. However, I still can't get the aggregation locked in, despite adding "input aggregationPeriod = AggregationPeriod.HOUR;". It still changes to whatever the current timeframe is on my charts.
Thank you for the reply. Sadly, this is still beyond my current ability of coding. I think I might have line 9 correct now, but no matter what I try, I cannot figure out where to put (period = aggregationperiod) in lines 10-16. From what I understand, I believe that is what you're telling me needs to be done. I've tried looking at other scripts for reference, but no matter what I try, I still can't figure it out. I also just read somewhere that when writing a code for a specific aggregation, the code will not work in higher time frames than what the code specifies. My goal is to have the Heikin Ashi Trend Dashboard displayed on a daily chart and always show/provide information for 1-Hr candles. Is this even a possibility? Thanks again. Sorry for being such an amateurAll of your calculations need to make use of the aggregation period selected, especially those Heikin Ashi ohlc calculations...
input useAlerts = no;
input alertType = Alert.BAR;
input buySound = Sound.DING;
input sellSound = Sound.BELL;
input colorBars = no;
input hideDashboard = no;
input aggregationPeriod = AggregationPeriod.HOUR;
def haClose = ohlc4 ("SPY", period = aggregationperiod);
def haOpen = (haOpen[1] + haClose[1]) / 2;
def haTrendUp = if haClose >= haOpen then 1 else 0;
def haTrendDn = if haClose < haOpen then 1 else 0;
def haSignal =
if haTrendUp == 1 and haTrendUp[1] == 1 then 1
else if haTrendDn == 1 and haTrendDn[1] == 1 then -1
else 0;
DefineGlobalColor("Label", Color.ORANGE);
DefineGlobalColor("UpTrend", Color.GREEN);
DefineGlobalColor("DnTrend", Color.RED);
DefineGlobalColor("Transition", Color.YELLOW);
AddLabel(!hideDashboard, "SPY Trend:", GlobalColor("Label"));
AddLabel(!hideDashboard, " ",
if haSignal[9] == 1 then GlobalColor("UpTrend")
else if haSignal[9] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition"));
AddLabel(!hideDashboard, " ",
if haSignal[8] == 1 then GlobalColor("UpTrend")
else if haSignal[8] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition"));
AddLabel(!hideDashboard, " ",
if haSignal[7] == 1 then GlobalColor("UpTrend")
else if haSignal[7] == -1 then GlobalColor("DnTrend")
else GlobalColor("Transition"));
A common error when using MTF indicators is trying to use a time frame that is lower than the chart you are posting it on.My goal is to have the Heikin Ashi Trend Dashboard displayed on a daily chart and always show/provide information for 1-Hr candles. Is this even a possibility? Thanks again. Sorry for being such an amateur
Thank you for the confirmation. I'll keep the script as it is on my daily chart, then simply toggle to the 1h timeframe when I want to see the corresponding SPY trend. Thanks again to you and rad14733 for your assistanceA common error when using MTF indicators is trying to use a time frame that is lower than the chart you are posting it on.
On the TOS platform, you can display data from a higher timeframe onto a lower timeframe but not the other way around.
As such, you can overlay daily on hourly but how cannot use hourly on your daily chart.
https://tlc.thinkorswim.com/center/...hapter-11---Referencing-Secondary-Aggregation
Hi Everybody, I want to thank everybody who contributed to writing the code and giving feedback to make using Heiken Ashi better for all of us. Thank you. I have a question - since we have the Heiken Ashi scan and dashboard, is there a way to have a script so you could keep track of the watchlist when the Heiken Ashi changes trend (green to yellow to red or just green and red. Ex, if you're using 5min chart, the watchlist script will let me know the direction (color) and the signal would stay in the script for 2-3 bars. Appriciate the help.I'm looking to have this same label, but I'd like it to be specifically for SPY with the aggregation set at 1-Hr. My goal is to have it on different charts with different timeframes, but always displaying the Heikin Ashi trend for SPY at the 1-Hr time frame. Thanks for any help!
In case anyone wants the scan parameter as I inquired above, here it is. Still trying to figure out how to scan for candles that are appearing as such for the first time (i.e. beginning of new trend after perhaps a lots of chop or a decline):I'm just becoming familiar with the useful clarity of Heiken Ashi candles. Is there a way to scan for issues where the green Heiken Ashi candles' opening and low price of the candle are the same (using either weekly or monthly charts)? Thank you for any help.
Please can you write the above script for thinkscript custom column so same dashboard show in watchlist ThanksHere is the Heikin_Ashi_Trend_Dashboard which can be added to charts to show the Heikin Ashi trend reversals... It also contains code for potential trend reversal alerts based on the yellow bars, includes colorbar code to color the chart candles, and the dashboard can also be disabled...
View attachment 11633
UPDATES:
# v1.0 : 2021-08-17 : Initial release
# v1.1 : 2021-08-18 : Modified to 10 bars from 5
# v1.2 : 2021-08-27 : Added option to hide Dashboard
Ruby:# Heikin_Ashi_Trend_Dashboard # Paints Yellow bar to signal potential trend reversals while Green and Red bars indicate trend direction. # Optionally sounds alerts on trend reversal while eliminating most false signals. # Optionally paints candles based on HA trend # Created by rad14733 for usethinkscript.com # v1.0 : 2021-08-17 : Initial release # v1.1 : 2021-08-18 : Modified to 10 bars from 5 # v1.2 : 2021-08-27 : Added option to hide Dashboard input useAlerts = no; input alertType = Alert.BAR; input buySound = Sound.DING; input sellSound = Sound.BELL; input colorBars = no; input hideDashboard = no; def haClose = ohlc4; def haOpen = (haOpen[1] + haClose[1]) / 2; def haTrendUp = if haClose >= haOpen then 1 else 0; def haTrendDn = if haClose < haOpen then 1 else 0; def haSignal = if haTrendUp == 1 and haTrendUp[1] == 1 then 1 else if haTrendDn == 1 and haTrendDn[1] == 1 then -1 else 0 ; DefineGlobalColor("Label", Color.ORANGE); DefineGlobalColor("UpTrend", Color.GREEN); DefineGlobalColor("DnTrend", Color.RED); DefineGlobalColor("Transition", Color.YELLOW); AddLabel(!hideDashboard, "HA Trend:", GlobalColor("Label")); AddLabel(!hideDashboard, " ", if haSignal[9] == 1 then GlobalColor("UpTrend") else if haSignal[9] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[8] == 1 then GlobalColor("UpTrend") else if haSignal[8] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[7] == 1 then GlobalColor("UpTrend") else if haSignal[7] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[6] == 1 then GlobalColor("UpTrend") else if haSignal[6] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[5] == 1 then GlobalColor("UpTrend") else if haSignal[5] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[4] == 1 then GlobalColor("UpTrend") else if haSignal[4] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[3] == 1 then GlobalColor("UpTrend") else if haSignal[3] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[2] == 1 then GlobalColor("UpTrend") else if haSignal[2] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal[1] == 1 then GlobalColor("UpTrend") else if haSignal[1] == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); AddLabel(!hideDashboard, " ", if haSignal == 1 then GlobalColor("UpTrend") else if haSignal == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") ); Alert(useAlerts and haSignal[1] == 0 and haSignal == 1, "HA Buy Signal", alertType, buySound); Alert(useAlerts and haSignal[1] == 0 and haSignal == -1, "HA Sell Signal", alertType, sellSound); AssignPriceColor(if colorBars then if haSignal == 1 then GlobalColor("UpTrend") else if haSignal == -1 then GlobalColor("DnTrend") else GlobalColor("Transition") else Color.CURRENT ); # END - Heikin_Ashi_Trend_Dashboard
Please can you write the above script for thinkscript custom column so same dashboard show in watchlist Thanks
# Heikin_Ashi Watchlist
# requested by suunys
def haClose = ohlc4;
def haOpen = (haOpen[1] + haClose[1]) / 2;
def haTrendUp = if haClose >= haOpen then 1 else 0;
def haTrendDn = if haClose < haOpen then 1 else 0;
def haSignal =
if haTrendUp == 1 and haTrendUp[1] == 1 then 1
else if haTrendDn == 1 and haTrendDn[1] == 1 then -1
else 0
;
AddLabel(yes, " ");
AssignBackgroundColor(
if haSignal == 1 then color.green
else if haSignal == -1 then color.red
else color.yellow
);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | Lower Chart Heiken Ashi With Candles | Questions | 1 | |
E | Heiken Ashi Overlay Displaced | Questions | 1 | |
I | MTF Dashboard Heiken Ashi Labels | Questions | 0 | |
Heiken Ashi Upper Indicator | Questions | 4 | ||
B | Heiken Ashi signal change | Questions | 0 |
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.