[pshaiCmd] Chaikin Money Flow

stable
By pshai in Momentum Published April 2021 👁 1,124 views 💬 0 comments

Description

Custom command for Chaikin Money Flow indicator
HaasScript
-- Author: [email protected]

DefineCommand('CMF', 'Chaikin Money Flow by pshai')

local h = DefineParameter(ListNumberType, 'h', 'High prices', true, HighPrices(), 'HighPrices')
local l = DefineParameter(ListNumberType, 'l', 'Low prices', true, LowPrices(), 'LowPrices')
local c = DefineParameter(ListNumberType, 'c', 'Close prices', true, ClosePrices(), 'ClosePrices')
local v = DefineParameter(ListNumberType, 'v', 'Volume', true, GetVolume(), 'GetVolume')
local len = DefineParameter(NumberType, 'length', 'CMF Length', true, 14, 'Input, Number')

local ad = (((c - l) - (h - c)) / (h - l)) * v
local mf = SMA(ad, len) / SMA(v, len)

DefineOutput(ListNumberType, mf, 'CMF Output', 'Plot')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!