Repaints MTF ADXr Color Changing w. DMI For ThinkOrSwim

Repaints

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.

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):

		
		
	


	
Sgp13B6.png
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
371 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