[pshaiCmd] Volume Oscillator (SE)

stable
By pshai in Oscillators Published October 2019 👁 1,717 views 💬 0 comments

Description

Volume Oscillator command. Parameters: * fastPeriod : Period length of fast MA * slowPeriod : Period length of slow MA * volume : Volume source * maType : Type of Moving Average Output: * Volume Oscillator values
HaasScript
DefineCommand('VolOsc', 'Volume Oscillator')

local fastPeriod = DefineParameter(NumberType, 'fastPeriod', 'Fast period length', true, 10, 'Input, Number')
local slowPeriod = DefineParameter(NumberType, 'slowPeriod', 'Slow period length', true, 20, 'Input, Number')
local volume = DefineParameter(ListNumberType, 'volume', 'Volume source', true, GetVolume(), 'GetVolume')
local maType = DefineParameter(EnumType, 'maType', 'Moving Average type', false, SmaType, 'InputMaTypes, MAEnums')

local fastVol = MA(volume, fastPeriod, maType)
local slowVol = MA(volume, slowPeriod, maType)
local volOsc = (fastVol - slowVol) / slowVol * 100

DefineOutput(ListNumberType, volOsc, 'Volume Oscillator values', 'Plot')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!