Lower study For Heikin Ashi candlesticks


Category:
0
0

Pete,

I’m looking for a lower study that will paint a green dots for a green candlestick and red dot for a red candlestick for the Heikin Ashi candlesticks….Then when it goes from red to green or green to red on the first candlestick it will paint a yellow dot…..Then go to either red or green dots…

Attachments:
Marked as spam
Posted by (Questions: 49, Answers: 42)
Asked on March 26, 2021 1:54 pm
732 views
0
Private answer

In order to complete this within the 15 minutes I allow for free solutions I provide free of charge in the Q&A Forum I will borrow the code from a previous post:

https://www.hahn-tech.com/ans/heikin-ashi-on-thinkorswim-mobile-app/

Please take the time to review the details on that post so you understand the original source of this code. The only change was to fascilitate the yellow bars for first green and first red Heiken-Ashi candles in each series.

In keeping with the original post I have designed this work on both the desktop version of Thinkorswim as well as the mobile app version. From the screenshot below you see that color of histogram bars cannot be changed. They will always display green when above zero and red when below zero. So in order to make the first green and red bars stand out from the rest those bars are shorter. On the desktop version those bars are yellow as requested.

declare lower;
def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
plot firstGreen = if haClose > haOpen and haClose[1] <= haOpen[1] then 0.5 else 0;
firstGreen.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
firstGreen.SetDefaultColor(Color.YELLOW);
plot firstRed = if haClose < haOpen and haClose[1] >= haOpen[1] then -0.5 else 0;
firstRed.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
firstRed.SetDefaultColor(Color.YELLOW);
plot trendUp = if !firstGreen and haClose > haOpen then 1 else 0;
trendUp.SetDefaultColor(Color.GREEN);
trendUp.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plot trendDown = if !firstRed and haClose < haOpen then -1 else 0;
trendDown.SetDefaultColor(Color.RED);
trendDown.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on March 27, 2021 1:01 pm
0
Thanks Pete....would it be possible make it look like the pic I attached since I overlay it onto another indicator....Thanks for the great work
( at March 27, 2021 1:13 pm)
0
Sorry I have already exceeded the time limit in providing the solution as it is.
( at March 27, 2021 2:28 pm)