ToS Moving Average Difference For ThinkOrSwim

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
This is the ToS Moving Average Difference with some lipstick added.
This provides similar but not as good data as:
https://usethinkscript.com/threads/donchian-channel-trend-for-thinkorswim.11848/#post-102682

But a member requested this one so here it is:
FzPvBya.png

Ruby:
# ################################
def mad = reference MAD("fast length" = 9, "slow length" = 27)."MAD";
# ################################
# Charting & Formatting
declare lower ;
declare real_size ;

plot pMAD = mad ;
     pMAD.SetLineWeight(2);
     pMAD.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#     pMAD.AssignValueColor(if mad>0 then color.green else color.red);

plot zeroline = 0;
     zeroline.SetPaintingStrategy(PaintingStrategy.DASHES);
     zeroline.SetDefaultColor(color.violet);
# ################################
# Tutorial to color plots
# ################################
DefineGlobalColor("color1", color.green) ;
DefineGlobalColor("color2", color.pink) ;
DefineGlobalColor("color3", color.red) ;
DefineGlobalColor("color4", color.dark_green) ;


#def NameOfPlot =  #put the name of the plot you want to color here ;
 def NameOfPlot =  mad ;

#def signal =     #put the name of the demarcation of over / under ;
 def signal =     0 ;


def pos        = NameOfPlot>= signal;
def neg        = NameOfPlot<  signal;
def up         = NameOfPlot >= NameOfPlot[1];
def dn         = NameOfPlot < NameOfPlot[1];

def PosUp = pos and up;
def PosDn = pos and dn;
def NegDn = neg and dn;
def NegUp = neg and up;

     pmad.AssignValueColor(
       if PosUp then GlobalColor("color1") else
       if PosDn then GlobalColor("color2") else
       if NegDn then GlobalColor("color3") else
       if NegUp then GlobalColor("color4") else Color.gray) ;
 
Last edited:
I use every indicator that you have published. You and @mashume are my idols.
I had need of a simple trend indicator to use to filter my potential candidates for trade.
Turns out your invention is very similar to what I use:
Here is your indicator (which is superior because it has more customizing options) compared to what I have been using:
ToS reference MAD() Moving Average Difference
LNBKkA3.png
what are you setting for MAD indicator on TOS? or the MAD indicator you have is customized? (if it is, please share the code?) Thank you.
can this be customized so there are four colors as follow: Positive trend green, green to negative- yellow, Bearish trend- red and negative to positive trend-White color.
 

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
607 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