instrument { overlay =true, name ='ASTROBOT ', short_name ='atsp', icon = "ADX"}
sec = security(current_ticker_id,"1m")
sec = security(current_ticker_id,"5m")
sec = security(current_ticker_id,"15m")
smaa = sma(close,'3')
smab = sma(close,'50')
smaao = sma(open,'3')
smabo = sma(open,'50')
plot(smaa,"SMA", smaa_color)
plot(smab,"SMA", smab_color)
emaa = ema(close, '100')
period = input(12,"[Link]",[Link],1)
source = input(1,"[Link]", input.string_selection, [Link])
fn = input(1,"[Link]", input.string_selection, [Link])
input_group {
"[Link]" ,
up_color = input {default = "#2CAC40", type = [Link]},
down_color = input {default = "#DB4931", type = [Link]},
}
local sourceSeries = inputs[source]
local averageFuntion = averages [fn]
mean = averageFunction (sourceSeries,period)
mad = sourceSeries- mean
rect {
first = 0,
second = mad,
color= mad >=mad [1] and up_color or down_color,
width = 0.4
}
if
( mad <=0 and (mad[1] > mad) and (smaa< smab) and (smaao> smabo) and close <=
emaa) then
plot_shape(1, 'Bear_Engulfing', shape_style.arrowdown,
shape_size.huge,"red", shape_location.abovebar, 0, "SELL","red")
end
if
( mad >=0 and (mad>mad[1]) and (smaa > smab) and close>= emaa and smaao <
smabo) then
plot_shape(1, 'Bull_Engulfing', shape_style.arrowup,
shape_size.huge,"green", shape_location.belowbar, 0, "BUY","green")
end
base = sma(open,'17')
high_band = base +(stdev(open, 17) * 2)
low_band = base -(stdev(open, 17) * 2)
media = sma (close, '20')
up_band = media + (stdev(close, 20) * 2.5)
down_band = media - (stdev(cloe, 20) * 2.5)
expo = ema(close, '100')
plot_shape ((open < up_band and high> up_band and close <= up_band and expo >
up_band),
"SELL1",shape_style.arrowdown, shape_size.huge,"white",
shape_location.abovebar, 0, "S1","white")
plot_shape ((open >down_band and low< down_band and close >= down_band and expo
< down_band),
"BUY1",shape_style.arrowup, shape_size.huge,"white",
shape_location.belowbar, 0, "B1","white")
--IMPULSOS
plot_shape((open > high_band and close < high_band),
"SELL",shape_style.circle, shape_size.little,"red",
shape_location.abovebar, 0, "S","red")
plot_shape((open < low_band and close > low_band),
"BUY",shape_style.circle, shape_size.little,"green",
shape_location.belowbar, 0, "B","green")