[pshaiCmd] Fractals

stable
By pshai in Other Published August 2021 👁 1,632 views 💬 0 comments

Description

Plots a pivot cross above or below the chart when detected.
HaasScript
-- Author: pshai
DefineCommand('Fractals', 'Plots a pivot cross above or below the chart when detected.')

local left = DefineParameter(NumberType, 'left', '', true, 3)
local right = DefineParameter(NumberType, 'right', '', true, 3)
local plot = DefineParameter(BooleanType, 'plot', '', false, true)

local lower = false
local upper = false

local h = HighPrices()
local high = ArrayGet(h, right+1)
local highLeft = GetHigh(Grab(h, right+1, left), left)
local highRight = GetHigh(h, right)

if high > highLeft and high > highRight then
    if plot then
        PlotShape(0, ShapeTriangleDown, Red, 3, true, {offset = -right})
    end

    upper = true
end


local l = LowPrices()
local low = ArrayGet(l, right+1)
local lowLeft = GetLow(Grab(l, right + 1, left), left)
local lowRight = GetLow(l, right)

if low < lowLeft and low < lowRight then
    if plot then
        PlotShape(0, ShapeTriangleUp, Green, 3, false, {offset = -right})
    end

    lower = true
end

DefineOutput(ListDynamicType, {upper = upper, lower = lower}, '')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!