Why Keltners in Stockcharts so different from ToS's?

floydddd

Active member
Anyone know why the Keltner results in ToS are so different from those at stockcharts.com? See pix for one example, plus the ToS code I'm using that allows for 3 different inputs to match what stockcharts allows. i've tried changing up all those average types but that doesn't seem to matter. Any other possibilities for why and/or what to do about it? generally speaking, i believe the stockcharts numbers are the accepted standard, so it'd be nice to get ToS to align with them.

for the example, the stockcharts low band reading at the close is $60.79. the tos reading is $62.52.

thanks!

declare upper;
declare weak_volume_dependency;

input displace = 0;
input factor = 3;
input length = 20;
input lengthATR = 10;
input price = close;
input averageType = AverageType.EXPONENTIAL;
input trueRangeAverageType = AverageType.WILDERS;

def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);

def average = MovingAverage(averageType, price, length);

plot Avg = average[-displace];
Avg.SetDefaultColor(GetColor(1));

plot Upper_Band = average[-displace] + shift[-displace];
Upper_Band.SetDefaultColor(GetColor(8));

plot Lower_Band = average[-displace] - shift[-displace];
Lower_Band.SetDefaultColor(GetColor(5));

MtgREHi[1].pngsgaER95[1].png
 
Well, my first thought is "is your trading system sensitive enough that the differences matter?" I have an extremely difficult time reasoning through a scenario where that difference will matter. Channels are extremely "imperfect" in the first place because they just show a range of possibilities based on history, which can't account for a zillion other things that actually drive market prices... like open interest at specific levels, for example. That's real vs a channel which is "fake" because it's just an arbitrary calculation based on arbitrary parameters.

However, regarding your question specifically, the documentation on StockCharts.com shows exactly how they're calculating the indicator. It doesn't talk about using a Wilders average though, so perhaps that's the difference. It could be a different average type. You're also using a "factor" of 3, but their formula shows an addition or subtraction of 2x the ATR, not 3x. Those are the most likely culprits. I think you're comparing apples and oranges, to some extent.

Why don't you just duplicate their exact indicator in ThinkScript code and see if they truly are different if you use the same parameters?

Here's the documentation from their page. This was simple to find.

https://chartschool.stockcharts.com...-overlays/technical-overlays/keltner-channels

Keltner Channels Calculation​

There are three steps to calculating Keltner Channels. First, select the length for the exponential moving average. Second, choose the time periods for the Average True Range (ATR). Third, choose the multiplier for the Average True Range.


Middle Line: 20-day exponential moving average
Upper Channel Line: 20-day EMA + (2 x ATR(10))
Lower Channel Line: 20-day EMA - (2 x ATR(10))
 
@floydddd Have you verified that ALL settings parameters are identical between the two versions... Some platforms use a Simple Average for both length and factor, as well as different lengthATR value... For my Keltner Channels I use the same parameters as your code above with the exception of using a factor of 1.5 or 2 and a lengthATR of 14 (ATR Default)...
 

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