Hi all, I am trying to create a script that will add a bubble when the stock goes up 10% AND the stock jumps 3% in the past 5 minutes. In other words, I want the bubbles to show up only after the stock has risen 10%. I wrote this script, the 3% part works, but TOS shows error "Invalid statement: if at 13:1" for the If statement. Can you please help fix it? Thank you.
Code:
input aggregationPeriod = AggregationPeriod.MIN;
def prev_close = close(period = aggregationPeriod)[5];
input priceType = PriceType.LAST;
def LastPrice = close(priceType = priceType);
def rise = close >= 1.03 * prev_close;
def agg = AggregationPeriod.DAY;
def TenPercentLine = (open(period = agg) * .1) + open(period = agg);
if close > TenPercentLine then
AddChartBubble(rise, low, "3%", Color.GREEN, no)
else Double.NaN;
Last edited: