macZLSMA Overlay For ThinkOrSwim

mbarcala

Active member
This is macZLSMA Overlay Indicator from tradingView converted by mbarcala, Enjoy!
Original Link: https://www.tradingview.com/script/ZGwKOzBZ-macZLSMA-Overlay/

Photo
13504[/ATTACH]']
jJ4RZLN.png


script
Code:
# macZLSMA Overlay from TradingView converted by mbarcala
#Original link: https://www.tradingview.com/script/ZGwKOzBZ-macZLSMA-Overlay/
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © veryfid
#//@version=4
#study(title = "macZLSMA Overlay", shorttitle="macZLSMA", overlay=true, resolution="")

declare lower;

input length = 20;
input length2 = 5;

def lsma = inertia(close, length);
def lsma2 = inertia(lsma, length);
def b = lsma-lsma2;

plot zlsma2 = lsma + b;

plot trig2 = ExpAverage(zlsma2,length2);
 

Attachments

  • jJ4RZLN.png
    jJ4RZLN.png
    223.6 KB · Views: 190
Last edited:
This is macZLSMA Overlay Indicator from tradingView converted by mbarcala, Enjoy!
Original Link: https://www.tradingview.com/script/ZGwKOzBZ-macZLSMA-Overlay/
I modified your code by changing colors when trend changes, and filling space between two moving averages for better signal tracking.
gJXs0Dw.png

Ruby:
# macZLSMA Overlay from TradingView converted by mbarcala
#Original link: https://www.tradingview.com/script/ZGwKOzBZ-macZLSMA-Overlay/
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © veryfid

#//@version=4

#study(title = "macZLSMA Overlay", shorttitle="macZLSMA", overlay=true, resolution="")

declare lower;

input length = 20;
input length2 = 5;

def lsma = inertia(close, length);
def lsma2 = inertia(lsma, length);
def b = lsma-lsma2;

plot zlsma2 = lsma + b;
plot trig2 = ExpAverage(zlsma2,length2);
AddCloud (zlsma2, trig2, Color.GREEN, Color.DARK_RED);
zlsma2.DefineColor("Up", GetColor(1));
zlsma2.DefineColor("Down", GetColor(0));
zlsma2.AssignValueColor(if zlsma2 > zlsma2[1] then zlsma2.color("Up") else zlsma2.color("Down"));
trig2.DefineColor("Up", GetColor(1));
trig2.DefineColor("Down", GetColor(0));
trig2.AssignValueColor(if trig2 > trig2[1] then trig2.color("Up") else trig2.color("Down"));
 
Last edited by a moderator:
Hi, I am new here, found tradeview code for ZLSMA, but i don't know how to convert it to TOS
anyone con help me?
https://www.tradingview.com/script/3LGnSrQN-ZLSMA-Zero-Lag-LSMA/


// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

// © veryfid



//@version=4



study(title = "ZLSMA - Zero Lag LSMA", shorttitle="ZLSMA", overlay=true, resolution="")

length = input(title="Length", type=input.integer, defval=32)

offset = input(title="Offset", type=input.integer, defval=0)

src = input(close, title="Source")

lsma = linreg(src, length, offset)

lsma2 = linreg(lsma, length, offset)

eq= lsma-lsma2

zlsma = lsma+eq



plot(zlsma, color=color.yellow, linewidth=3)


thanks in advance
here is a similar idea on bottom indicator, if you deleted "declare lower" it will work on top.
link: https://usethinkscript.com/threads/maczlsma-overlay-for-thinkorswim.10208/

now in this other sample I did change the idea of linear regression to Average and it give you a more close resolve in my opinion.
script:
Code:
# This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
# study(title = "ZLSMA - Zero Lag LSMA", shorttitle="ZLSMA", overlay=true, resolution="")

input length = 32;

def lsma = Average(close, length);
def lsma2 = Average(lsma, length);
def eq = lsma - lsma2;
plot zlsma = lsma + eq;

Photo:
https%3A//i.imgur.com/NhW4Gqc.png[/img]']
NhW4Gqc.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
426 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