MiamiFlorida
New member
Hello, I am trying to have visibility of higher time frame moving averages on a lower time frame chart. For example, on the 1 minute chart I would like to see where the monthly 50 SMA is. It was my understanding that you can only access data from time frame charts greater than or equal to your current one, so I was under the assumption that this would work. The smallest time frame that I have been able to make it work is a 360 day chart. Any idea how I can fix this? Any help would be appreciated.
This is the code I have been using:
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.Month;
input length = 50;
input averageType = AverageType.SIMPLE;
def MovAvg = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
plot MALine = highestAll(if isNaN(close[-1])
then MovAvg
else Double.NaN);
MALine.SetStyle(Curve.Short_Dash);
MALine.SetLineWeight(1);
MALine.SetDefaultColor(CreateColor(50,250,150));
This is the code I have been using:
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.Month;
input length = 50;
input averageType = AverageType.SIMPLE;
def MovAvg = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
plot MALine = highestAll(if isNaN(close[-1])
then MovAvg
else Double.NaN);
MALine.SetStyle(Curve.Short_Dash);
MALine.SetLineWeight(1);
MALine.SetDefaultColor(CreateColor(50,250,150));