This is probably a very easy question. I'm using code for EMA that someone here helped me fine tune. In this code I would like the bubble to be the same color as the plot line. I am able to choose the plot color from the options page, but not sure how to make the bubble the same color.
ALTERNATIVELY, if someone can show me how to fix the code so that I can also choose the color of the bubble
ALTERNATIVELY, if someone can show me how to fix the code so that I can also choose the color of the bubble
Code:
input price = close;
input length = 13;
input displace = 0;
input location = {default OffSet, LastBar, RightEdge};
input BubbleOffset = 5;
def bar = BarNumber();
def lb = if !IsNaN(close) and IsNaN(close()[-1]) then bar else Double.Nan;
def lastBar = highestAll(lb);
def position;
switch (location) {
case RightEdge:
position = bar == HighestAll(bar);
case LastBar:
position = bar == lastBar;
CASE Offset:
position = bar == lastbar + BubbleOffset;
}
plot ma1 = MovingAverage(AverageType.EXPONENTIAL, price, length);
#plot ma1 = MovAvgExponential(close (period = AggregationPeriod.DAY), length);
ma1.SetDefaultColor(Color.CYAN);
def data2 = if !IsNaN(ma1) then ma1 else data2[1];
AddChartBubble(position, data2, length + " EMA");