I would like to add an indicator line to an intraday chart that is 10% below the DailySMA(close,10). Ideally I'd just like to have it sit under today's DailySMA(close,10) but would be OK with it extending to the right.
Here is what I have so far... but it's not working.
Thank you,
Louise
Here is what I have so far... but it's not working.
Code:
def D_SMA99 = (DailySMA(FundamentalType.CLOSE, 10, AggregationPeriod.DAY)) * 0.99;
input showOnlyLastPeriod = yes;
input BeginNumOfPeriodsBack = 0;
input EndNumOfPeriodsBack = 0;
def BeginningPeriod = Close(period =aggregationPeriod.Day)[-BeginNumOfPeriodsBack-1];
def EndingPeriod = Close(period = aggregationPeriod.Day)[-EndNumOfPeriodsBack];
plot data;
data = if ShowOnlyLastPeriod and !IsNaN(EndingPeriod) and IsNaN(BeginningPeriod)
then D_SMA99 else 0;
data.SetDefaultColor(color.RED);
data.Setstyle(curve.FIRM);
addlabel(yes,concat("10SMA x 99% = ",D_SMA99),color.RED);
Thank you,
Louise