HPotter

The Volume-Weighted MACD Histogram

The related article is copyrighted material from Stocks & Commodities 2009 Oct
Remove from Favorite Scripts Add to Favorite Scripts
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 29/08/2014
// The related article is copyrighted material from Stocks & Commodities 2009 Oct 
////////////////////////////////////////////////////////////
study(title="Combining Exponential And Volume Weighting")
Long_period = input(26, minval=1)
Short_period = input(12, minval=1)
Smoothing_period = input(9, minval=1)
xLongMAVolPrice = ema(volume * close, Long_period) 
xLongMAVol = ema(volume, Long_period) 
xResLong = (xLongMAVolPrice * Long_period) / (xLongMAVol * Long_period)
xShortMAVolPrice = ema(volume * close, Short_period) 
xShortMAVol = ema(volume, Short_period) 
xResShort = (xShortMAVolPrice * Short_period) / (xShortMAVol * Short_period)
xVMACD = xResShort - xResLong
xVMACDSignal = ema(xVMACD, Smoothing_period)
nRes = xVMACD - xVMACDSignal
plot(nRes, color=blue, style = histogram )
DONATE/TIP

BTC: 1Lo1GoTNsPbrjGAgPgF4MYZPhBFdoVHaTm
Just a comment, in line 14 the multiplication of Short_period is redundant. You're multiplying both your numerator and denominator by it.
Reply
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
ประเทศไทย
Việt Nam
日本
한국
简体
繁體
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 Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out