Right, so there is no way for the mobile app to recognize code that attempts to paint the color of the candles. The work around, as you have hinted, is the create an indicator that displays it in some other way.
I have experimented with designing mobile apps for Thinkorswim. I have found that even trying to dynamically set the color based on some condition is not possible. The mobile apps selects its own colors, just because.
So this code plots as a lower study. It’s plots as a histogram. We don’t bother assigning any colors here because the mobile app will just ignore them. On a desktop chart this indicator will plot all one color. However on the mobile app it will paint the histogram bars green when above zero and red when below zero.
At this point in Thinkorswim’s technology, this is the best we can do. Here is the code, followed by a screenshot showing the result.
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 trend = if haClose > haOpen then 1 else if haClose < haOpen then -1 else 0;
trend.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
That’s fantastic, thanks so much Hahn! I tested it out on my mobile and it works.
I was wondering if I could take this a step further and tie this indicator to just a daily chart. How would I go about this? My idea is that I’d like to know what the color of the daily heikin Ashi candle is showing while looking at a 30-min timeframe. I’m looking at implementing an alert on the 30-min, but only want to be alerted if the HA on the daily is either green or red. Any ideas?
Sorry, that is not supported in the mobile app at this time. This is what we call a secondary aggregation. Trying to reference a higher time frame a smaller time frame chart. You can do this in the desktop version but not in the mobile version.