RMA (mod)

stable
By Strooth in Trend Published July 2022 👁 1,371 views 💬 0 comments

Description

Just a mod to enable/disable plot
HaasScript
DefineCommand('RMA', 'Relative Moving Average')
 
local c = DefineParameter(ListNumberType, 'c', 'Close prices', true, ClosePrices(), 'ClosePrices')
local len = DefineParameter(NumberType, 'length', 'RMA Length', true, 14, 'Input, Number')
local type = DefineParameter(EnumType, 'type', 'MA Type to base calculations on', false, SmaType, 'InputMaTypes, Enumerations Moving Averages')
local plot = DefineParameter(BooleanType, 'plot', 'plot the lines', false, true, 'true/false')
 
local ma1 = MA(c, len * 3, type)
local ma2 = MA(c, len * 2, type)
local ma3 = MA(c, len, type)
 
local ret = ma1 - ma2 + ma3

if plot then 
    Plot(0, 'RMA', ret)
end
 
DefineOutput(ListNumberType, ret, 'RMA Output', 'Plot')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!