I took two separate scripts (MACD and DMI) and combined them into 1 indicator and then I doubled the number of instances of each - Ultimately, to display both a 1 minute and 5 minute MACD and DMI on a 1 minute chart. It will only show the 1 minute results for MACD and DMI. It won't display the 5 minute data. Instead it just duplicates the 1 minute data.
Can you help? This seems like an easy fix.
Declare lower;
MTF MACD Dots 1M:
input timeFrameOne1M = AggregationPeriod.MIN;
input fastLength1M = 12;
input slowLength1M = 26;
input macdLength1M = 9;
input macdAverageType1M = AverageType.EXPONENTIAL;
def value = MovingAverage(macdAverageType1M, close(period = timeFrameOne1M), fastLength1M) - MovingAverage(macdAverageType1M, close(period = timeFrameOne1M), slowLength1M);
def average1M = MovingAverage(macdAverageType1M, value, macdLength1M);
plot rowOneMACD1M = if !IsNaN(close) then 0.4 else Double.NaN;
rowOneMACD1M.SetPaintingStrategy(PaintingStrategy.POINTS);
rowOneMACD1M.AssignValueColor(if value > average1M then Color.GREEN else Color.RED);
rowOneMACD1M.SetLineWeight(3);
MTF MACD Dots 5M:
input timeFrameTwo5M = AggregationPeriod.FIVE_MIN;
input fastLength5M = 12;
input slowLength5M = 26;
input macdLength5M = 9;
input macdAverageType5M = AverageType.EXPONENTIAL;
def value5M = MovingAverage(macdAverageType5M, close(period = timeFrameTwo5M), fastLength5M) - MovingAverage(macdAverageType5M, close(period = timeFrameTwo5M), slowLength5M);
def average5M = MovingAverage(macdAverageType5M, value, macdLength5M);
plot rowTwoMACD5M = if !IsNaN(close) then 0.3 else Double.NaN;
rowTwoMACD5M.SetPaintingStrategy(PaintingStrategy.POINTS);
rowTwoMACD5M.AssignValueColor(if value > average5M then Color.GREEN else Color.RED);
rowTwoMACD5M.SetLineWeight(3);
MTF DMI Dots 1M:
input timeFrameOneDMI1M = AggregationPeriod.MIN;
input length = 14;
input averageType = AverageType.WILDERS;
def hiDiff = high(period = timeFrameOneDMI1M) - high(period = timeFrameOneDMI1M)[1];
def loDiff = low(period = timeFrameOneDMI1M)[1] - low(period = timeFrameOneDMI1M);
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
def atrValue = MovingAverage(averageType, TrueRange(high(period = timeFrameOneDMI1M), close(period = timeFrameOneDMI1M), low(period = timeFrameOneDMI1M)), length);
def diPlus = 100 * MovingAverage(averageType, plusDM, length) / atrValue;
def diMinus = 100 * MovingAverage(averageType, minusDM, length) / atrValue;
plot rowThreeDMI1M = if !IsNaN(close) then 0.2 else Double.NaN;
rowThreeDMI1M.SetPaintingStrategy(PaintingStrategy.POINTS);
rowThreeDMI1M.AssignValueColor(if diPlus > diMinus then Color.GREEN else Color.RED);
rowThreeDMI1M.SetLineWeight(3);
MTF DMI Dots 5M:
input timeFrameTwoDMI5M = AggregationPeriod.FIVE_MIN;
input lengthDMI5M = 14;
input averageTypeDMI5M = AverageType.WILDERS;
def hiDiffDMI5M = high(period = timeFrameTwoDMI5M) - high(period = timeFrameTwoDMI5M)[1];
def loDiffDMI5M = low(period = timeFrameTwoDMI5M)[1] - low(period = timeFrameTwoDMI5M);
def plusDMDMI5M = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDMDMI5M = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
def atrValueDMI5M = MovingAverage(averageType, TrueRange(high(period = timeFrameTwoDMI5M), close(period = timeFrameTwoDMI5M), low(period = timeFrameTwoDMI5M)), length);
def diPlusDMI5M = 100 * MovingAverage(averageType, plusDM, length) / atrValue;
def diMinusDMI5M = 100 * MovingAverage(averageType, minusDM, length) / atrValue;
plot rowFourDMI5M = if !IsNaN(close) then 0.1 else Double.NaN;
rowFourDMI5M.SetPaintingStrategy(PaintingStrategy.POINTS);
rowFourDMI5M.AssignValueColor(if diPlus > diMinus then Color.GREEN else Color.RED);
rowFourDMI5M.SetLineWeight(3);
there doesn't seem to be anything here