DeMarker Indicator for ThinkorSwim


Staff member
Demarker is an indicator similar to DM+ developed by Welles Wilder. The DM+ (a part of Directional Movement System which includes both DM+ and DM- indicators) indicator helps determine if a security is "trending." The differences between the indicators are in the somewhat different calculation methods.

If the indicator value is over 0.5, the period is suited for buying, if less - for selling. The farther is the value from 0.5, the stronger are the trend dynamics. If the value is within 0.5, the trend is either flattening or going to revert.



thinkScript Code

# DeMarker Indicator
# Assembled by BenTen at
# BenTen also added 0.5 line to the script and removed paintbars
# Converted from

declare lower;

input per = 13;
input HV = .4;
input LV = .6;
input MD = .5;

def demax = if high>high[1] then high-high[1] else 0;  
def demin = if low<low[1] then low[1]-low else 0;
def demax_av = simpleMovingAvg(demax, per);
def demin_av = simpleMovingAvg(demin, per);
def dmark = demax_av / (demax_av + demin_av);

plot DeMarker = dmark;
plot upper_line = LV;
plot lower_line = HV;
plot middle = MD;
Last edited:
Do you think it would be possible to code into Demarker 1 his concept of Excessive Duration Zones?

“The ideal condition for a meaningful reversal is when an excessively oversold zone, then return to the neutral zone, followed by a mild return into the oversold zone (less than 13 price bars in this zone). When this behavior is concurrent with a longer-term indicator like Sequential or Combo this will enhance the probability of a meaningful reversal.”
This another DeMarker Indicator from TradingView converted to TOS. Enjoy!
Original TradingView Link:

Upper indicator:

# DeMarker Reversals converted to TOS by mbarcala
# link:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at
#// © EasyTradingSignals

#study(title="ETS DeMarker Reversals", shorttitle="ETS DM Reversals")
#//Thanks to scarf's "DeMarker with Highlights" which this is based on

declare lower;

input length = 20;

def demax = (high > high[1]) + (high - high[1]);
def demin = (low < low[1]) + (low[1] - low);

def demax_av = ExpAverage(demax, length);
def demin_av = ExpAverage(demin, length);

plot dmark = ExpAverage(demax_av / (demax_av + demin_av) * 100, 3);

plot ml = 50;

plot hm = 75;

plot lm = 25;

plot h1 = 55;

plot h2 = 45;

AddCloud(dmark, hm, Color.RED, CreateColor(27, 27, 27));
AddCloud(dmark, lm, CreateColor(27, 27, 27), Color.GREEN);


  • V7MEbjh.png
    373.1 KB · Views: 175
Last edited by a moderator:

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
349 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.