You are on page 1of 2

instrument{name="RSI + MACD @ Efraim Traders",

short_name="Strategy RSI + MACD @ Efraim traders ",


icon="https://efraimtraders.com/wp-content/uploads/2022/03/Touro.png",
overlay=true}

overlay = true
Exibir_tracamento= input(1,"")
Exibir= input(1,"Sempre observar atentamente a tendencia e lembrar das 3 ultimas
entradas, se estiver respeitando e um otimo sinal para operar. OBS: Evitar sempre a
abertura e o fechamento do mercado equipe!")
Exibir= input(1,"EfraimTraders! SE FOR USAR DA OS CREDITOS E GRATUITO")
--Macd
fast = input (12, "front.platform.fast period", input.integer, 1, 250)
slow = input (26, "front.platform.fast period", input.integer, 1, 250)

-- Cal Macd

fastMA = ema(close, fast)


slowMA = ema(close, slow)

macd = fastMA - slowMA

signal = ema(macd, signal_period)

hist = macd - signal

--RSI

period = input (14, "RSI Period", input.integer, 1)


rsi_ovb = input (70, "RSI OVB", input.double, 0.01)
rsi_ovs = input (30, "RSI OVB", input.double, 0.01)
source = input (1, "Price Apply", input.string_selection, inputs.titles)
fn = input (averages.ssma, "front.newind.average", input.string_selection,
averages.titles)

local sourceSeries = inputs [source]


local averageFunction = averages [fn]

delta = sourceSeries - sourceSeries [1]

up = averageFunction (max (delta, 0), period)


down = averageFunction (max (-delta, 0), period)

rs = up / down
res = 100 - 100 / (1 + rs)

input_group{
"MACD Only",
macd_color_sell = input { default = "red", type = input.color },
macd_color_buy = input { default = "green", type = input.color },
macd_visible = input { default = true, type = input.plot_visibility }

input_group{
"RSI Only",
rsi_color_sell = input { default = "orange", type = input.color },
rsi_color_buy = input { default = "blue", type = input.color },
rsi_visible = input { default = true, type = input.plot_visibility }

input_group{
"RSI and Macd",
rsimacd_color_sell = input { default = "magenta", type = input.color },
rsimacd_color_buy = input { default = "aqual", type = input.color },
rsimacd_visible = input { default = true, type = input.plot_visibility }

--Plot Shape Arrow

SELL_MACD = macd[0] < macd[1] and macd[0] < macd[2] and macd[1] > macd[2] and macd
> 0
BUY_MACD = macd[0] > macd[1] and macd[0] > macd[2] and macd[1] < macd[2] and macd
< 0

plot_shape(SELL_MACD and macd_visible,"SELL_MACD", shape_style.triangledown,


shape_size.auto, macd_color_sell, shape_location.abovebar, 0, "", macd_color_sell)
plot_shape(BUY_MACD and macd_visible,"BUY_MACD", shape_style.triangleup,
shape_size.auto, macd_color_buy, shape_location.belowbar, 0, "", macd_color_buy)

SELL_RSI = res[0] < res[1] and res[0] < res[2] and res[1] > res[2] and res[1] >
rsi_ovb
BUY_RSI = res[0] > res[1] and res[0] > res[2] and res[1] < res[2] and res[1] <
rsi_ovs

plot_shape(SELL_RSI and rsi_visible,"SELL_RSI", shape_style.triangledown,


shape_size.auto, rsi_color_sell, shape_location.abovebar, 0, "", rsi_color_sell)
plot_shape(BUY_RSI and rsi_visible,"BUY_RSI", shape_style.triangleup,
shape_size.auto, rsi_color_buy, shape_location.belowbar, 0, "", rsi_color_buy)

-- RSI OVB/OVS + MACD


Sell_RSI_MACD = res[1] > rsi_ovb and macd[0] < macd[1] and macd[0] < macd[2] and
macd[1] > macd[2] and macd > 0
Buy_RSI_MACD = res[1] < rsi_ovs and macd[0] > macd[1] and macd[0] > macd[2] and
macd[1] < macd[2] and macd < 0

plot_shape(Sell_RSI_MACD and rsimacd_visible,"Sell_RSI_MACD",


shape_style.triangledown, shape_size.auto, rsimacd_color_sell,
shape_location.abovebar, 0, "", rsimacd_color_sell)
plot_shape(Buy_RSI_MACD and rsimacd_visible,"Buy_RSI_MACD", shape_style.triangleup,
shape_size.auto, rsimacd_color_buy, shape_location.belowbar, 0, "",
rsimacd_color_buy)

You might also like