[pshaiCmd] DZO – Dynamic Zones Oscillator (SE)

0 71 Views No Comments 4 weeks ago
  • 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/

    • This topic was modified 3 weeks, 4 days ago by pshai.
    HaasScript Code
    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')
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free