0% found this document useful (0 votes)
78 views2 pages

3 Retração

This document defines a Fibonacci retracement indicator for MetaTrader 5. It includes inputs to configure the indicator lines and defines functions to calculate the retracement levels on each candlestick.

Uploaded by

Pedro Rodriguez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views2 pages

3 Retração

This document defines a Fibonacci retracement indicator for MetaTrader 5. It includes inputs to configure the indicator lines and defines functions to calculate the retracement levels on each candlestick.

Uploaded by

Pedro Rodriguez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

instrument { name = "Retracao em M5", icon="indicators:ADX", overlay = true }

method_id = input (1, "Type", input.string_selection, { "Pontos da Fibo" })

input_group {
"M0",

level_0_color = input { default = "white", type = input.color },


level_0_width = input { default = 1, type = input.line_width }
}

input_group {
"Mx",

level_1_color = input { default = "red", type = input.color },


level_1_width = input { default = 1, type = input.line_width }
}

input_group {
"Mn",

level_2_color = input { default = "green", type = input.color },


level_2_width = input { default = 1, type = input.line_width }
}

input_group {
"Tx",

level_3_color = input { default = "grey", type = input.color },


level_3_width = input { default = 1, type = input.line_width }
}

local function Pontos_da_Fibo(candle)


M0 = (candle.low + candle.high) / 2
Mx = candle.high
Mn = candle.low
if candle.close < candle.open then
Tx1 = M0 + (candle.high - M0) * 0.236
Tx2 = M0 + (candle.high - M0) * 0.618
Tx3 = M0 + (candle.low - M0) * 0.236
Tx4 = M0 + (candle.low - M0) * 0.53
elseif candle.close > candle.open then
Tx1 = M0 + (candle.high - M0) * 0.53
Tx2 = M0 + (candle.high - M0) * 0.236
Tx3 = M0 + (candle.low - M0) * 0.618
Tx4 = M0 + (candle.low - M0) * 0.236
end
end

local methods = { Pontos_da_Fibo }

local resolution = "1D"

if is_daily then
resolution = "1M"
elseif is_weekly or is_monthly then
resolution = "1Y"
end
sec = security (current_ticker_id, resolution)

if sec then
local method = methods [method_id]

method (sec)

plot (M0, "M0", level_0_color, level_0_width, 0, style.levels,


na_mode.restart)
plot (Mx, "Mx", level_1_color, level_1_width, 0, style.levels,
na_mode.restart)
plot (Mn, "Mn", level_2_color, level_2_width, 0, style.levels,
na_mode.restart)
plot (Tx1, "Tx", level_3_color, level_3_width, 0, style.levels,
na_mode.restart)
plot (Tx2, "Tx", level_3_color, level_3_width, 0, style.levels,
na_mode.restart)
plot (Tx3, "Tx", level_3_color, level_3_width, 0, style.levels,
na_mode.restart)
plot (Tx4, "Tx", level_3_color, level_3_width, 0, style.levels,
na_mode.restart)

end

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy