ADX Histogram

Phil

New member
First time posting a question in this forum but I've been browsing useThinkScript for years. It's been interesting to say the least and many times way over my head.

I use TOS Renko charts for daily Forex scalping. TOS is more of a family member to me than a platform. I've modified a few built in scripts and what not but I'm mainly clueless when coding. I'm proud of myself to know how to plot a line or create an alert for an indicator that wasn't there but desperately needed. I most like being able to change code for one indicator and it changes it for all my open charts that are using that indicator. Very useful.

I have a good basic strategy that includes ADX on Renko charts. Here is my question.

I use ADX as a histogram. I had no problem creating an alert when ADX went over a certain number. What I would like to be able to do is create an alert when the next histogram bar is of greater value than the one before it. Maybe even be able to give that bar a different color.

A guy on Tradingview has this called "ADX with color like MACD Histogram". Does anyone know of a ThinkScript version of this ADX, or can easily pinpoint the code I would need to modify my existing ADX to accomplish this. Does anyone here already have this modified ADX or sees a need for this type of alert?

Being a first time poster with a question, I don't expect everyone to jump on this and fix my problem. Just thought I would give it a shot and see what happens. Thanks very much.

Phil
 
First time posting a question in this forum but I've been browsing useThinkScript for years. It's been interesting to say the least and many times way over my head.
Why don't you post the script, what you got, and do a mockup of what you are looking for? that makes life easy for anybody looking to provide a solution.
 
Last edited:

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

So I kept goofing with it until I figured it out.

Months ago I modified an ADX indicator that I found in this group. I just liked that it had different colored bars for increasing levels of ADX. I added an alert to it and have been using it for a long time. Now I modified it to show lower or higher ADX bars after the "trend" level.

Blue under "notrend"
Orange between "notrend" and "trend"
Green over "trend" but red if the ADX bar is lower than the last, and of course green again if the ADX moves higher.

For me it's all about the quick visual. Glad I figured this out because I've been wanting it for a long time.

I realize that this is super simple thinkscript but it's new to me so....

Hope this is useful to someone other than myself and if it's already out there somewhere, my apologies.

Code:
declare lower;

input length = 6;
input averageType = AverageType.WILDERS;

def endTrend = 60;
def noTrend =25;
def Trend =30;
def Alertsound =30;

plot ADX = DMI(length, averageType).ADX;
ADX.setDefaultColor(GetColor(5));

ADX.AssignValueColor(if ADX < noTrend then
                       Color.BLUE
                    else
                       if ADX > Trend and ADX > ADX[1] then
                          Color.green
                    else
                       if ADX > Trend and ADX < ADX[1] then
                          Color.red
                    else
                          Color.dark_orange
                    );

ADX.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

plot upbound = endTrend;
plot lobound = noTrend;
plot midbound = Trend;

def Above = adx crosses above alertsound;

#Trigger alerts
Alert(Above[1], "ADX_Above_30", Alert.BAR, Sound.chimes);
 
  • Like
Reactions: ALV
you can reference the Above series in your code for earlier bars, much as you do for the Alert:
Code:
Alert(Above[2] AND adx > adx[1], "ADX Continuing up", alert.bar, sound.chimes);
adding colouration to the script would just mean adding another else to your chain of if/else conditions. I think.

I apologize for not taking the time to flesh this out more than here in the text editor. If you still haven't figured it out, don't hesitate to come back and tell me my code didn't work. It may and it may not. ;-)

-mashume
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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