Kijun-Sen T-View to TOS help


study(title="Kijun-Sen+", shorttitle="Kijun-Sen+", overlay=true)

basePeriods = input(26, minval=1, title="Period")
donchian(len) => avg(lowest(len), highest(len))
baseLine = donchian(basePeriods)
plot(baseLine, color=#991515, title="Kijun-Sen")
Screenshot (8).png

Can anyone help translate this to something TOS would accept?
Thank you
Last edited by a moderator:
declare upper;
input basePeriods = 26;
def donchian = (lowest(CLOSE, basePeriods) + highest(CLOSE, basePeriods)) / 2;
plot kijun_sen = donchian;

I'm not sure whether the avg() function is returning the average of two values, or a simple moving average over some length... I chose the first.

maybe someone else has a better idea?

happy trading,
Last edited:
its pretty darn close from comparing thus far
Im trying to copy this strat I saw online. Seems to work pretty well so want to implement it to TOS as sometimes T-View doesnt give me real time on some tickers. Most time yes but not always.
ok found some inconsistencies. For example these 2 screen shots one from T View and the other TOS

and TOS one


notice right after small red candle the next green bar barely crosses while in TOS it was way up there already.
Last edited by a moderator:
Perhaps it has to do with the way each is showing (or how much each is showing) of the stuff off to the left of the chart. I can't speak to the internals of either Tradeview or ThinkOrSwim... They look similar by the time the right-hand side of your chart is reached. No idea why. Have you looked to see that the preceding 26 bars are all the same for both platforms? It could just be a data problem.

Not a lot of help, but we kinda take what ToS gives us. We can mould it, warp it, and mix it up a whole lot, but at the end of the day, we just deal with what we get out.


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