[pshaiCmd] DZO - Dynamic Zones Oscillator (SE)

stable
By pshai in Oscillators Published July 2020 👁 1,815 views 💬 0 comments

Description

Recreation of DZO – “Dynamic Zones Oscillator” – original by allanster(TV)

In form of basic indicator, but can be remade to Command as well.
Indication of custom percentage “overbought/oversold” – with option to use on any price source and can also be combined with other indicators – for instance RSI, CCI, or any other single data line
original documentation: https://www.tradingview.com/script/AoChfBer-How-To-Use-Dynamic-Zones/ Visual Editor version by bunka: https://www.haasscripts.com/t/dzo-dynamic-zones-oscillator-allanster/
HaasScript
DefineCommand('DZO', 'Dynamic Zone Oscillator')

local pnr = function(src, len, pcnt)
    local index = Round((pcnt / 100) * (len + 1), 0)
    local smpl = ArrayGet(Grab(src, 0, len), index)

    return smpl
end

local oscSrc = DefineParameter(ListNumberType, 'oscSrc', 'Oscillator source. Preferably indicator or price data series.', true, ClosePrices())
local dataSmple = DefineParameter(NumberType, 'dataSmple', 'Sample Length', true, 70)
local pcntAbove = DefineParameter(NumberType, 'pcntAbove', 'Hi is Above X% of Sample', true, 88)
local pcntBelow = DefineParameter(NumberType, 'pcntBelow', 'Lo is Below X% of Sample', true, 88)

local smplAbove = pnr(oscSrc, dataSmple, pcntAbove)
local smplBelow = pnr(oscSrc, dataSmple, 100 - pcntBelow)

DefineOutput(ListDynamicType, {above = smplAbove, below = smplBelow}, 'Results')
DefineOutputIndex(1, NumberType, 'above', 'Sample above source')
DefineOutputIndex(2, NumberType, 'below', 'Sample below source')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!