mAcDX Reverser For ThinkOrSwim
Another fire indicator converted from my Sierra coded study collection. It looks for MACD at an extreme and ADX over 30 and turning, indicating that a strong trending condition is likely. Color bars are warning that price might turn soon. Arrow is entry.
Another fire indicator converted from my Sierra coded study collection. It looks for MACD at an extreme and ADX over 30 and turning, indicating that a strong trending condition is likely. Color bars are warning that price might turn soon. Arrow is entry.
Code:
## mAcDX Reverser
## V 1.0 : created by Chence27
declare upper;
# --- Inputs
input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.SIMPLE;
input length = 1000;
input paintBars = yes;
# --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/-
def ADX = reference ADX;
def MACD = reference MACD()."Value";
def priceMean = Average(MACD, length);
def MACD_stdev = (MACD - priceMean) / StDev(MACD, length);
# --- End Indicators
# --- Conditions
def sellerBasic = ADX > 20 and ADX<ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3]and MACD_stdev < -1;
def sellerRegular = ADX > 30 and ADX<ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev < -1;
def sellerExtreme = ADX > 30 and ADX<ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev < -2;
def buyerBasic = ADX > 20 and ADX<ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev > 1;
def buyerRegular = ADX > 30 and ADX<ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev > 1;
def buyerExtreme = ADX > 30 and ADX<ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev > 2;
def PresellerBasic = ADX > 20 and ADX>ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev < -1;
def PresellerRegular = ADX > 30 and ADX>ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev < -1;
def PresellerExtreme = ADX > 30 and ADX>ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev < -2;
def PrebuyerBasic = ADX > 20 and ADX>ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev > 1;
def PrebuyerRegular = ADX > 30 and ADX>ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev > 1;
def PrebuyerExtreme = ADX > 30 and ADX>ADX[1] and ADX[1]>ADX[2] and ADX[2]>ADX[3] and MACD_stdev > 2;
# --- End Conditions
# -- Price Color
AssignPriceColor( if paintBars and PresellerExtreme then Color.CYAN else if PrebuyerExtreme and paintBars then Color.MAGENTA else if paintBars and PresellerRegular then Color.GREEN else if PrebuyerRegular and paintBars then Color.RED else if paintBars and PresellerBasic then Color.LIGHT_GREEN else if PrebuyerBasic and paintBars then Color.LIGHT_RED else if paintBars then Color.GRAY else Color.CURRENT);
# --- Arrows/Triggers
plot ExtremeBuy = if sellerExtreme then low else Double.NaN;
ExtremeBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ExtremeBuy.SetDefaultColor(Color.CYAN);
plot ExtremeSell = if buyerExtreme then high else Double.NaN;
ExtremeSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ExtremeSell.SetDefaultColor(Color.MAGENTA);
plot RegularBuy = if sellerRegular then low else Double.NaN;
RegularBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
RegularBuy.SetDefaultColor(Color.GREEN);
plot RegularSell = if buyerRegular then high else Double.NaN;
RegularSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
RegularSell.SetDefaultColor(Color.RED);
plot BasicBuy = if sellerBasic then low else Double.NaN;
BasicBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BasicBuy.SetDefaultColor(Color.LIGHT_GREEN);
plot BasicSell = if buyerBasic then high else Double.NaN;
BasicSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
BasicSell.SetDefaultColor(Color.LIGHT_RED);
Last edited by a moderator: