0% acharam este documento útil (0 voto)
163 visualizações1 página

Sup Res Liq Aju

Direitos autorais
© © All Rights Reserved
Levamos muito a sério os direitos de conteúdo. Se você suspeita que este conteúdo é seu, reivindique-o aqui.
Formatos disponíveis
Baixe no formato TXT, PDF, TXT ou leia on-line no Scribd
0% acharam este documento útil (0 voto)
163 visualizações1 página

Sup Res Liq Aju

Direitos autorais
© © All Rights Reserved
Levamos muito a sério os direitos de conteúdo. Se você suspeita que este conteúdo é seu, reivindique-o aqui.
Formatos disponíveis
Baixe no formato TXT, PDF, TXT ou leia on-line no Scribd

instrument {

name = "Suporte e Resistência com Liquidez Ajustada",


short_name = "SR Liquidez Ajustada",
overlay = true
}

period = input(30, "Período SMA", input.integer, 1)

input_group {
"Linhas de Suporte e Resistência",
sr_color = input { default = "white", type = input.color },
sr_width = input { default = 1, type = input.line_width }
}

input_group {
"Linhas de Liquidez",
compra_color = input { default = "green", type = input.color },
venda_color = input { default = "red", type = input.color },
liquidez_width = input { default = 1, type = input.line_width }
}

-- Calculando as médias e as bandas de suporte e resistência


sma_value = sma(close, period)
high_band = sma_value + (stdev(close, period) * 2)
low_band = sma_value - (stdev(close, period) * 2)

-- Plotando as linhas de suporte e resistência (fixas)


plot(high_band, "Resistência", sr_color, sr_width)
plot(low_band, "Suporte", sr_color, sr_width)

-- Variáveis para armazenar os níveis de liquidez


nivel_liquidez_compra = na
nivel_liquidez_venda = na

-- Verificação e definição dos níveis de liquidez


if close > high_band and isnan(nivel_liquidez_compra) then
nivel_liquidez_compra = high_band
elseif close < low_band and isnan(nivel_liquidez_venda) then
nivel_liquidez_venda = low_band
end

-- Plotando as linhas de liquidez apenas quando atingidas e mantendo fixas


if not isnan(nivel_liquidez_compra) then
plot(nivel_liquidez_compra, "Liquidez Compra", compra_color, liquidez_width)
end

if not isnan(nivel_liquidez_venda) then


plot(nivel_liquidez_venda, "Liquidez Venda", venda_color, liquidez_width)
end

Você também pode gostar