HPotter

Bill Williams Averages SMMA

This indicator calculates 3 Smoothed moving average for default values of
13, 8 and 5 days, with displacement 8, 5 and 3 days.
The most popular method of interpreting a moving average is to compare
the relationship between a moving average of the security's price with
the security's price itself (or between several moving averages).
Remove from Favorite Scripts Add to Favorite Scripts
////////////////////////////////////////////////////////////
//  Copyright by HPotter v2.0 24/09/2014
// This indicator calculates 3 Smoothed moving average for default values of
// 13, 8 and 5 days, with displacement 8, 5 and 3 days: Median Price (High+Low/2).
// The most popular method of interpreting a moving average is to compare 
// the relationship between a moving average of the security's price with 
// the security's price itself (or between several moving averages).
////////////////////////////////////////////////////////////

study(title="Bill Williams Averages. 3Lines", shorttitle="3 Lines", overlay = true)
LLength = input(13, minval=1)
MLength = input(8,minval=1)
SLength = input(5,minval=1)
LOffset = input(8,minval=1)
MOffset = input(5,minval=1)
SOffset = input(3,minval=1)
SUM1 = sum(close, LLength)
SMMA1 = SUM1/LLength
PREVSUM1 = SMMA1[1] * LLength
SMMAL = (PREVSUM1-nz(SMMAL[1])+close)/LLength
SUM2 = sum(close, MLength)
SMMA2 = SUM2/MLength
PREVSUM2 = SMMA2[1] * MLength
SMMAM = (PREVSUM2-nz(SMMAM[1])+close)/MLength
SUM3 = sum(close, SLength)
SMMA3 = SUM3/SLength
PREVSUM3 = SMMA3[1] * SLength
SMMAS = (PREVSUM3-nz(SMMAS[1])+close)/SLength
plot(SMMAL[LOffset], color=blue, title="SMMA L")
plot(SMMAM[MOffset], color=red, title="SMMA M")
plot(SMMAS[SOffset], color=green, title="SMMA S")
DONATE/TIP

BTC: 1Lo1GoTNsPbrjGAgPgF4MYZPhBFdoVHaTm
THANK YOU so much for doing this.

Apparently they've added SMMA as an indicator. To test this, I compared a 13-period non-shifted SMMA (native indicator) to the shifted SMMA (your code here). They were very different. Perhaps it's possible to use the native SMMA method?
Reply
HPotter PRO the_batman
In the script I used formula from link what you send me in the other thread and code it. But I no not sure that is real formula. In the TV, how I know, don`t exists a builtin function of SMMA, but I can wrong.
+1 Reply
moveon HPotter
Click on the arrow icon right to the TradingView menu "indicators". There you will find the "Bill William's 3 Lines" indicator.
Reply
moveon moveon
To me your code and TV code looks to show identical signals:

snapshot
+1 Reply
Yeah, because the original is wrong. For the reason's stated in the original comment. (ie it uses SIMPLE moving average instead of SMOOTHED).
+1 Reply
the_batman HPotter
I think you're right. The formula I sent is wrong. (Sorry).

Here's the code (ie formula) from the SMMA indicator:

src = close
len = input(7, minval=1, title="Length")
smma = na(smma) ? sma(src, len) : (smma * (len - 1) + src) / len

+1 Reply
United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out