Rich-Trader
New member
I am not a coder and understand the logic of the language but am able to look and see and do thigs based off what I se or see others teach. So I am able to do some simple things. This code is for an MTF ADX that changes color based on whether the DMI is bullish or bearish. There are three plots that you can set to whatever aggregation period you want to use in your chart. The first indicator I have ever created was a Inverse Fisher Stochastic with two stochastic plots I call it a sling shot. I already posted the code but if you want it it will be part of the share link.
Just want to give back a little in hopes it blesses some one. I am a scalper and this really helped me with timing of cycle and momentum to enter trades.
Just want to give back a little in hopes it blesses some one. I am a scalper and this really helped me with timing of cycle and momentum to enter trades.
Rich (BB code):
declare lower;
input length = 14;
input averageType = AverageType.WILDERS;
input aggPeriod = AggregationPeriod.DAY;
###### MTF ADX 1
def hiDiff = high(period = aggPeriod) - high(period = aggPeriod)[1];
def loDiff = low(period = aggPeriod)[1] - low(period = aggPeriod);
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 ATR = MovingAverage(averageType, TrueRange(high(period = aggPeriod), close(period = aggPeriod), low(period = aggPeriod)), length);
def DIPlus = 100 * MovingAverage(averageType, plusDM, length) / ATR;
def DIMinus = 100 * MovingAverage(averageType, minusDM, length) / ATR;
def DX = if (DIPlus + DIMinus > 0) then 100 * AbsValue(DIPlus - DIMinus) / (DIPlus + DIMinus) else 0;
plot ADX = MovingAverage(averageType, DX, length);
ADX.AssignValueColor(if DIPlus > DIMinus then Color.GREEN else Color.RED);
###### MTF ADX 2
input length2 = 14;
input averageType2 = AverageType.WILDERS;
input aggPeriod2 = AggregationPeriod.DAY;
def hiDiff2 = high(period = aggPeriod2) - high(period = aggPeriod2)[1];
def loDiff2 = low(period = aggPeriod2)[1] - low(period = aggPeriod2);
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 ATR2 = MovingAverage(averageType2, TrueRange(high(period = aggPeriod2), close(period = aggPeriod2), low(period = aggPeriod2)), length2);
def DIPlus2 = 100 * MovingAverage(averageType2, plusDM2, length2) / ATR2;
def DIMinus2 = 100 * MovingAverage(averageType2, minusDM2, length2) / ATR2;
def DX2 = if (DIPlus2 + DIMinus2 > 0) then 100 * AbsValue(DIPlus2 - DIMinus2) / (DIPlus2 + DIMinus2) else 0;
plot ADX2 = MovingAverage(averageType2, DX2, length2);
ADX2.AssignValueColor(if DIPlus2 > DIMinus2 then Color.GREEN else Color.RED);
###### MTF ADX 3
input length3 = 14;
input averageType3 = AverageType.WILDERS;
input aggPeriod3 = AggregationPeriod.DAY;
def hiDiff3 = high(period = aggPeriod3) - high(period = aggPeriod3)[1];
def loDiff3 = low(period = aggPeriod3)[1] - low(period = aggPeriod3);
def plusDM3 = if hiDiff3 > loDiff3 and hiDiff3 > 0 then hiDiff3 else 0;
def minusDM3 = if loDiff3 > hiDiff3 and loDiff3 > 0 then loDiff3 else 0;
def ATR3 = MovingAverage(averageType3, TrueRange(high(period = aggPeriod3), close(period = aggPeriod3), low(period = aggPeriod3)), length3);
def DIPlus3 = 100 * MovingAverage(averageType3, plusDM3, length3) / ATR3;
def DIMinus3 = 100 * MovingAverage(averageType3, minusDM3, length3) / ATR3;
def DX3 = if (DIPlus3 + DIMinus3 > 0) then 100 * AbsValue(DIPlus3 - DIMinus3) / (DIPlus3 + DIMinus3) else 0;
plot ADX3 = MovingAverage(averageType3, DX3, length3);
ADX3.AssignValueColor(if DIPlus3 > DIMinus3 then Color.GREEN else Color.RED);
plot ZeroLine = 25;
ZeroLine.SetDefaultColor(Color.PINK);
share link: https://tos.mx/9sydZyY
Rich (BB code):