instrument {
name = 'STAKE WIN',
short_name = 'D',
icon= '[Link]
overlay = true
}
MaFast_period = input(1,"Ma Fast period",[Link],1,1000,1)
MaValue = input(5,"Ma Value", input.string_selection,[Link])
MaSlow_period = input(34,"Ma Slow period",[Link],1,1000,1)
Signal_period = input(5,"Signal period",[Link],1,1000,1)
input_group {
"Compra",
colorBuy = input { default = "yellow", type = [Link] },
visibleBuy = input { default = true, type = input.plot_visibility }
}
input_group {
"Venda",
colorSell = input { default = "blue", type = [Link] },
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),
"",
shape_style.triangleup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
-1,
"",
"yellow"
)
plot_shape(
(sellCondition),
"",
shape_style.triangledown,
shape_size.huge,
colorSell,
shape_location.abovebar,
-1,
"",
"blue"
)
instrument {overlay = true,
name = 'STAKE WIN',
short_name = '1',
icon="indicators:ADX"}
input_group { "BLUE - UP COLOR", call_color = input { default="#49cd84", type =
[Link] } }
input_group { "RED - DOWN COLOR", put_color = input { default="#e46cac", type =
[Link] } }
sec = security(current_ticker_id, "1m")
if ((close[1] < open[1]) and (close > open) and (close > high[1])) then
plot_shape(1,
'bull_Heikin',
shape_style.circle,
shape_size.huge,
call_color,
shape_location.belowbar,
0,
"U ",
call_color )
else
if ((close[1] > open[1]) and (close < open) and (close < low[1])) then
plot_shape(1,
'bear_Heikin',
shape_style.circle,
shape_size.huge,
put_color,
shape_location.abovebar,
0,
"D",
put_color)
end
end