In the attached code, I'd like for each chart bubble to show the number of days since the last occurance.
The goal is illustrated in this image:
(For simplicity, I have excluded the engulfing/magenta criteria from the code below. I figure having the solution for inside should be able to be copied with appropriate modification easily.)
Ideally, the blue numbers represent the numbers the bubble should show (definitely could be off by one and I do apologize for not having a very great screen capture program...)
I totally understand why the bubbles are showing 0 currently.
My inclination is that some sort of loop will be needed to pull this off but so far I have had no luck with them in thinkscript!!
Thanks in advance for any assistance!!
The goal is illustrated in this image:
(For simplicity, I have excluded the engulfing/magenta criteria from the code below. I figure having the solution for inside should be able to be copied with appropriate modification easily.)
Ideally, the blue numbers represent the numbers the bubble should show (definitely could be off by one and I do apologize for not having a very great screen capture program...)
I totally understand why the bubbles are showing 0 currently.
My inclination is that some sort of loop will be needed to pull this off but so far I have had no luck with them in thinkscript!!
Thanks in advance for any assistance!!
Code:
def insideDay = low > low[1] and high < high[1];
def daysSinceInsideDay = if insideDay then 0 else daysSinceInsideDay[1] + 1;
AddChartBubble(insideday,High(period=aggregationperiod.day),dayssinceinsideday,color.yellow,yes);
def labelValue = daysSinceInsideDay;
AddLabel(yes,"Days Since Inside: "+dayssinceinsideday,color.yellow);
AssignPriceColor(if insideday then color.yellow else color.gray);