mAcDX Reverser For ThinkOrSwim

Chence27

Active member
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.

XjKzvHA.png

I1Cow3V.png


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:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Sorry, I don't understand the purpose of the "Preseller.." & "Prebuyer.." variables, they are exactly the same as the "seller.." and "buyer.." variables.

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;

The "AssignPriceColor(..." statement could just use the "seller.." & "buyer.. variables, and the "Preseller.." & "Prebuyer.." variables would not be needed.
 
Sorry, I don't understand the purpose of the "Preseller.." & "Prebuyer.." variables, they are exactly the same as the "seller.." and "buyer.." variables.

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;

The "AssignPriceColor(..." statement could just use the "seller.." & "buyer.. variables, and the "Preseller.." & "Prebuyer.." variables would not be needed.
No, they are not the same. Pay close attention to the code. A small detail can make a big difference.

The first section of code is signaling when ADX makes a swing high. The second section of code is signaling when ADX makes three consecutive higher highs.
 
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.

XjKzvHA.png

I1Cow3V.png


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);
@Chence27 Thank you so much for sharing this code. I think it's awesome. Would you happen to have a scan for it?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
356 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top