Plotting 2 SMI Periods aligned at the same zero-line

Cybersloth

Member
This simplified SMI indicator kindly provided by Dap is very useful on its own but is also interesting when examined comparatively in juxtaposition with other SMI indicator lengths on the same panel (the default setting is 4) rather than on different lower indicator panels. However, I notice when I place the settings at, say, 4 and 13 for the two comparative lengths SMI on the same panel, the zero line is not quite the same for either. Is there a way to align 2 or more SMI studies with varying lengths at the same zero point in a single panel? The formula for the study is below.

##SMI

declare lower;

input Length = 4;

#Add your indicator code here (if you want to use this as a template) :)
def min_low = Lowest(low, Length+1);
def max_high = Highest(high, Length+1);

def rel_diff = close - (max_high + min_low) / 2;
def range = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, Length), Length );
def avgdiff = ExpAverage(ExpAverage(range, Length), Length);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.DefineColor("Up", GetColor(1));
SMI.DefineColor("Down", GetColor(0));
SMI.AssignValueColor(if SMI > SMI[1] then SMI.color("Up") else SMI.color("Down"));
SMI.SetLineWeight(2);

plot line_0 = 0;

##
 
Solution
This simplified SMI indicator kindly provided by Dap is very useful on its own but is also interesting when examined comparatively in juxtaposition with other SMI indicator lengths on the same panel (the default setting is 4) rather than on different lower indicator panels. However, I notice when I place the settings at, say, 4 and 13 for the two comparative lengths SMI on the same panel, the zero line is not quite the same for either. Is there a way to align 2 or more SMI studies with varying lengths at the same zero point in a single panel? The formula for the study is below.

##SMI

declare lower;

input Length = 4;

#Add your indicator code here (if you want to use this as a template) :)
def min_low = Lowest(low, Length+1)...
This simplified SMI indicator kindly provided by Dap is very useful on its own but is also interesting when examined comparatively in juxtaposition with other SMI indicator lengths on the same panel (the default setting is 4) rather than on different lower indicator panels. However, I notice when I place the settings at, say, 4 and 13 for the two comparative lengths SMI on the same panel, the zero line is not quite the same for either. Is there a way to align 2 or more SMI studies with varying lengths at the same zero point in a single panel? The formula for the study is below.

##SMI

declare lower;

input Length = 4;

#Add your indicator code here (if you want to use this as a template) :)
def min_low = Lowest(low, Length+1);
def max_high = Highest(high, Length+1);

def rel_diff = close - (max_high + min_low) / 2;
def range = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, Length), Length );
def avgdiff = ExpAverage(ExpAverage(range, Length), Length);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.DefineColor("Up", GetColor(1));
SMI.DefineColor("Down", GetColor(0));
SMI.AssignValueColor(if SMI > SMI[1] then SMI.color("Up") else SMI.color("Down"));
SMI.SetLineWeight(2);

plot line_0 = 0;

##
https://usethinkscript.com/threads/declare-real_size-in-thinkorswim.14506/
 
Solution

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