hinkognito
New member
Hello All,
Could anyone help with this? Attempting to generate a MTF DMI Oscillator lower study. Here is what I got to, but I am getting errors with my time period. Any suggestions are welcome.
Many Thanks!
Could anyone help with this? Attempting to generate a MTF DMI Oscillator lower study. Here is what I got to, but I am getting errors with my time period. Any suggestions are welcome.
Many Thanks!
Code:
declare lower;
input length = 14;
input averageType = AverageType.WILDERS;
input Time2 = AggregationPeriod.FIFTEEN_MIN;
input Time3 = AggregationPeriod.FIVE_MIN;
def hiDiff1 = high - high[1];
def loDiff1 = low[1] - low;
def plusDM1 = if hiDiff1 > loDiff1 and hiDiff1 > 0 then hiDiff1 else 0;
def minusDM1 = if loDiff1 > hiDiff1 and loDiff1 > 0 then loDiff1 else 0;
def hiDiff2 = high(period=time2) - high[1](period=time2);
def loDiff2 = low[1](period=time2) - low(period=time2);
def plusDM2 = if hiDiff2 > loDiff2 and hiDiff2 > 0 then hiDiff2 else 0;
def minusDM2 = if loDiff2 > hiDiff2 and loDiff2 > 0 then loDiff2 else 0;
def hiDiff3 = high(period=time3) - high[1](period=time3);
def loDiff3 = low[1](period=time3) - low(period=time3);
def plusDM2 = if hiDiff3 > loDiff3 and hiDiff3 > 0 then hiDiff3 else 0;
def minusDM2 = if loDiff3 > hiDiff3 and loDiff3 > 0 then loDiff3 else 0;
plot osc1 = plusdm1-minusdm1;
plot osc2 = plusdm2-minusdm2;
plot osc3 = plusdm3-minusdm3;