You are on page 1of 5

instrument {overlay = true,

name = 'Setup de Wall Street 01',


short_name = '@otraderdewallstreet',
icon="indicators:ADX"}

input_group { "OTC - UP COLOR", call_color = input { default="green", type =


input.color } }
input_group { "OTC - DOWN COLOR", put_color = input { default="red", type =
input.color } }

if ((close > close[2]) and (close[2] > open[2]) and (close[4] > close[8])) then

plot_shape(1,
'Bull_OTC',
shape_style.triangleup,
shape_size.huge,
call_color,
shape_location.belowbar,
0,
"",
"#fcfc03"
)
else
if ((close < close[2]) and (close[2] < open[2]) and (close[4] < close[8])) then

plot_shape(1,
'Bear_OTC',
shape_style.triangledown,
shape_size.huge,
put_color,
shape_location.abovebar,
0,
"",
"#fcfc03"
)
end
end

instrument { name = "Setup de Wall Street 01", icon="indicators:ADX", overlay =


true }
method_id = input (1, "Type", input.string_selection, { "@otraderdewallstreet" })

input_group {
"Maxima",
level_1_color = input { default = "Red", type = input.color },
level_1_width = input { default = 4, type = input.line_width }
}

input_group {
"Minima",
level_2_color = input { default = "Green", type = input.color },
level_2_width = input { default = 4, type = input.line_width }
}

local function h4(candle)

c1 = candle.high
c2 = candle.low
end

local methods = { h4 }

local resolution = "4H"

sec = security (current_ticker_id, resolution)

if sec then
local method = methods [method_id]
method (sec)

plot (c1, "C1", level_1_color, level_1_width, 0, style.levels, na_mode.continue)


plot (c2, "C2", level_2_color, level_2_width, 0, style.levels, na_mode.continue)

end

instrument {
name = 'Setup de Wall Street 01',
short_name = '@otraderdewallstreet',
icon = 'indicators:ADX',
overlay = true
}

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


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

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


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

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

MaTrend_period = input(200,"Ma Trend period",input.integer,1,1000,5)


MaTrend_average = input(2,"Ma Trend average",
input.string_selection,averages.titles)
MaTrend_title = input(1,"Ma Trend title", input.string_selection,inputs.titles)

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 }
}

input_group {
"Ma Fast Line",
colorFast = input { default = "white", type = input.color },
widthFast = input { default = 1, type = input.line_width},
visibleFast = input { default = true, type = input.plot_visibility }
}

input_group {
"Ma Slow Line",
colorSlow = input { default = "white", type = input.color },
widthSlow = input { default = 2, type = input.line_width},
visibleSlow = input { default = false, type = input.plot_visibility }
}

input_group {
"Buy Klen",
backgroundcolorbuy = input { default = "green", type = input.color },
visibleBuy2 = input { default = true, type = input.plot_visibility }
}

input_group {
"Sell Klen",
backgroundcolorsell = input { default = "red", type = input.color },
visibleSell2 = 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]

local avgSignal = averages[Signal_period]

local avgTrend = averages[MaTrend_average]


local titleTrend = inputs[MaTrend_title]

if visibleFast == true then


plot(avgFast(titleFast,MaFast_period),"Ma Fast",colorFast,widthFast)
end

if visibleSlow == true then


plot(avgSlow(titleSlow,MaSlow_period),"Ma Slow",colorSlow,widthSlow)
end

if visibleTrend == true then


plot(avgTrend(titleTrend,MaTrend_period),"Ma Trend",colorTrend,widthTrend)
end

candle_time = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
candle_time_res = input(6,"Candle check
resolution",input.string_selection,candle_time)

sec = security (current_ticker_id, candle_time[candle_time_res])

filter_source = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
filter_pa_index = input(8,"Candle check
resolution",input.string_selection,filter_source)

filter_pa = security (current_ticker_id, filter_source[filter_pa_index])

--print(filter_source[filter_pa_index])

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

signal = avgSignal(macd,Signal_period)

--plot(macd,"macd", "Green", 1)
--plot(signal,"signal", "Red", 1)

histo = macd - signal

--rect {
--first = 0,
--second = histo,
--color = histo >= histo[1] and "Green" or "Red",
--width = 0.5
--}

--hline(0,"Zero Macd", "rgba(255, 20, 147, 0.4)",1)

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]

MaTrend0 = avgTrend(titleTrend,MaTrend_period)
MaTrend1 = MaTrend0[1]

if (visibleArea == true) then


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

end

end

local function a()local


b=make_series()local c=high[2]

if not get_value(c)then
return b end;
local d=high<=c and high[1]<=c and high[3]<=c and high[4]<=c;
b:set(iff(d,c,b[1]))return b end;
local function e()local b=make_series()local c=low[2]if not get_value(c)then return
b end;
local d=low>=c and low[1]>=c and low[3]>=c and low[4]>=c;
b:set(iff(d,c,b[1]))return b end;
input_group{"Color",color=input{default="white",type=input.color},width=input{defau
lt=1,type=input.line_width}}h=a()l=e()hline(h,"High",color,high_width)hline(l,"Low"
,color,width)hline(highest(10)[1],"HH10",color,1)hline(lowest(10)
[1],"LL10",color,1)hline(highest(30)[1],"HH30",color,1)hline(lowest(30)
[1],"LL30",color,1)hline(highest(60)[1],"HH60",color,1)hline(lowest(60)
[1],"LL60",color,1)hline(highest(100)[1],"HH100",color,1)hline(lowest(100)
[1],"LL100",color,1)hline(highest(150)[1],"HH150",color,1)hline(lowest(150)
[1],"LL150",color,1)hline(highest(200)[1],"HH200",color,1)hline(lowest(200)
[1],"LL200",color,1)

instrument{name="Setup de Wall Street 01",


short_name = '@otraderdewallstreet',
icon = 'indicators:BB',
overlay=true}

Exibir_tracamento= input(1, "Deseja exibir o tracamento?", input.string_selection,


{"SIM", "NAO"})

input_group {"BANDA SUPERIOR", bbsup_color= input{ default= "silver", type=


input.color}}
input_group {"BANDA INFERIOR", bbinf_color= input{ default= "silver", type=
input.color}}

smaa= sma(close, '20')


upper_band= smaa + (stdev(close,20) * 2.5)
lower_band= smaa - (stdev(close,20) * 2.5)
emaa= ema(close, '100')

if Exibir_tracamento == 1 then
plot(emaa, "SMA", ema_color)
plot(upper_band, "UPPER_BAND", bbsup_color)
plot(lower_band, "LOWER_BAND", bbinf_color)
end

You might also like