Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

instrument {

name = 'DISTANCIA DA MDIA DE 20',


short_name = 'DISTANCIA DA MDIA',
icon =
'https://media.seudinheiro.com/cdn-cgi/image/fit=contain,width=640&,format=auto/
uploads/2021/07/Bolsa-628x353.png',
overlay = true}

input_group { "CALL - WIN", call_color = input { default="green", type =


input.color } }
input_group { "PUT - WIN", put_color = input { default="red", type =
input.color } }
input_group { "SMAA", smaa_color = input{ default = "yellow", type =
input.color } }

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


MaFast_average = input(1,"Ma Fast average", input.string_selection,averages.titles)
MaFast_title = input(1,"Ma Fast title", input.string_selection,inputs.titles)

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


MaSlow_average = input(1,"Ma Slow average", input.string_selection,averages.titles)
MaSlow_title = input(2,"Ma Slow title", input.string_selection,inputs.titles)

smaa = sma(close, '20')

plot(smaa, "SMA", smaa_color)

input_group {
"Area Up and Down",
colorAreaUp = input { default = "rgba(220, 20, 60, 0.3)", type = input.color },

colorAreaDown = input { default = "rgba(34, 139, 34, 0.3)", type =


input.color },
visibleArea = input { default = true, type = input.plot_visibility }}

local avgFast = averages[MaFast_average]


local titleFast = inputs[MaFast_title]

local avgSlow = averages[MaSlow_average]


local titleSlow = inputs[MaSlow_title]

sec = security (current_ticker_id, '5m')

filter_pa = security (current_ticker_id, '5m')

emaFast = avgFast(titleFast,MaFast_period)
emaSlow = avgSlow(titleSlow,MaSlow_period)

if (sec ~= nil) then

MaFast0 = avgFast(titleFast,MaFast_period) --Ma Fast bar 0


MaFast1 = MaFast0[1] --Ma Fast bar 1

MaSlow0 = avgSlow(titleSlow,MaSlow_period) --Ma Slow bar 0


MaSlow1 = MaSlow0[1]

if (visibleArea == true) then


fill(MaFast0,MaSlow0,"Area", MaFast0 > MaSlow0 and colorAreaUp or MaFast0 <
MaSlow0 and colorAreaDown)

ca=0

plot_shape((close < smaa)and (minute[0]==55 or minute[0]==10 or


minute[0]==25 or minute[0]==40),
'PUT',
shape_style.circle,
shape_size.normal,
put_color,
shape_location.belowbar,
0,
"",
put_color)

plot_shape(( close > smaa) and (minute[0]==55 or minute[0]==10 or


minute[0]==25 or minute[0]==40),
'CALL',
shape_style.circle,
shape_size.normal,
call_color,
shape_location.abovebar,
0,
"",
call_color)
end
end

You might also like