You are on page 1of 4

instrument {

name = 'GO EFRAIM',


short_name = 'GO EFRAIM',

overlay = true
}

MaFast_period = input(1,"Ma Fast period",input.integer,1,1000,1)


MaValue = input(5,"Ma Value", input.string_selection,inputs.titles)

MaSlow_period = input(34,"Ma Slow period",input.integer,1,1000,1)

Signal_period = input(5,"Signal period",input.integer,1,1000,1)

input_group {
"Compra",
colorBuy = input { default = "green", type = input.color },
visibleBuy = input { default = true, type = input.plot_visibility }
}

input_group {
"Venda",
colorSell = input { default = "red", type = input.color },
visibleSell = input { default = true, type = input.plot_visibility }
}

local titleValue = inputs[MaValue]

-- mdia mvel linear rpida


smaFast = sma(titleValue, MaFast_period)

-- mdia mvel linear devagar


smaSlow = sma(titleValue, MaSlow_period)

-- calculo diferencial - serie


buffer1 = smaFast - smaSlow

-- clculo da mdia mvel ponderada - serie


buffer2 = wma(buffer1, Signal_period)

buyCondition = conditional(buffer1 > buffer2 and buffer1[1] < buffer2[1] and not
(buffer1 < buffer2 and buffer1[1] > buffer2[1]))
buyCondition = conditional(buffer1 > buffer2 and buffer1[1] < buffer2[1])

sellCondition = conditional(buffer1 < buffer2 and buffer1[1] > buffer2[1] and not
(buffer1 > buffer2 and buffer1[1] < buffer2[1]))
sellCondition = conditional(buffer1 < buffer2 and buffer1[1] > buffer2[1] )

plot_shape(
(buyCondition),
"Higher",
shape_style.triangleup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
-1,
"Higher",
"green"
)
plot_shape(
(sellCondition),
"Lower",
shape_style.triangledown,
shape_size.huge,
colorSell,
shape_location.abovebar,
-1,
"Lower",
"red"
)
-- https://www.tradingview.com/script/VP32b3aR-Average-True-Range-Trailing-
Stops-Colored/
instrument { name = "ATR Trailing Stops", overlay = true, icon="indicators:ATR" }
period = input (14, "front.period", input.integer, 1 )
multiplier = input (2, "front.newind.multiplier", input.double, 1 )
high_low = input (false, "HighLow", input.boolean)
input_group {
"front.newind.colors",
up = input { default = "#2CAC40", type = input.color },
down = input { default = "#DB4931", type = input.color },
width = input { default = 1, type = input.line_width }
}
atr = rma (tr, period) * multiplier
h = iff (high_low, high, close)
l = iff (high_low, low, close)
atr_ts = iff(close > nz(atr_ts[1], 0) and close[1] > nz(atr_ts[1], 0),
max(nz(atr_ts[1]), h - atr),
iff(close < nz(atr_ts[1], 0) and close[1] < nz(atr_ts[1], 0), min(nz(atr_ts[1]), l
+ atr),
iff(close > nz(atr_ts[1], 0), h - atr, l + atr)))
pos = iff(close[1] < nz(atr_ts[1], 0) and close > nz(atr_ts[1], 0), 1,
iff(close[1] > nz(atr_ts[1], 0) and close < nz(atr_ts[1], 0), -1, nz(pos[1], 0)))
plot (atr_ts, "", pos < 0 and down or up , width)
--[[
short = (pos[1] != pos[0]) and (pos[0] == -1) ? true : false
long = (pos[1] != pos[0]) and (pos[0] == 1) ? true : false
plotshape(long, style=shape.triangleup, location=location.belowbar, color=green,
size=size.tiny)
plotshape(short, style=shape.triangledown, location=location.abovebar, color=red,
size=size.tiny)
]]

instrument {
name = "Jhon trader",
overlay = " true",
}
input_group {
"MACD",
"Slow and fast EMA periods, used in MACD calculation",
fast = input (12, "front.platform.fast period", input.integer, 1, 250),
slow = input (26, "front.platform.fast period", input.integer, 1, 250)
}
input_group {
"front.platform.signal-line",
"Reference signal series period",
signal_period = input (9, "front.period", input.integer, 1, 250)
}
input_group {
"front.newind.emaperiod",
ema_period = input (13, "front.period", input.integer, 1, 250)
}
input_group {
"front.newind.barcolors",
positive = input { default = "#2CAC40", type = input.color },
neutral = input { default = "#FFFF00", type = input.color },
negative = input { default = "#DB4931", type = input.color },
}
fastMA = ema(close, fast)
slowMA = ema(close, slow)
macd = fastMA - slowMA
signal = sma(macd, signal_period)
hist = macd - signal
ema13 = ema (close, ema_period)
local bar_color
if ema13 > ema13 [1] and hist > hist [1] then
bar_color = positive
elseif ema13 < ema13 [1] and hist < hist [1] then
bar_color = negative
else
bar_color = neutral
end
plot_candle (open, high, low, close, "ES", bar_color)
instrument { name = "BS Channels", overlay = true }
period = input (20, "front.period", input.integer, 1, 200)
input_group {
"front.top line",
upper_line_visible = input { default = true, type = input.plot_visibility },
upper_line_color = input { default = "#2384C2", type = input.color },
upper_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.bottom line",
lower_line_visible = input { default = true, type = input.plot_visibility },
lower_line_color = input { default = "#2384C2", type = input.color },
lower_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.newind.adx.fill",
fill_visible = input { default = true, type = input.plot_visibility },
fill_color = input { default = rgba(219, 40, 242, 0.07), type =
input.color },
}
upper = highest (high, period)
lower = lowest (low, period)
middle = (upper + lower) / 2
if fill_visible then
fill { first = upper, second = lower, color = fill_color }
end
if upper_line_visible then
plot (upper, "front.top line", upper_line_color, upper_line_width)
end
if lower_line_visible then
plot (lower, "front.bottom line", lower_line_color, lower_line_width)
end
if middle_line_visible then
plot (middle, "front.middle line", middle_line_color, middle_line_width)
end

You might also like