0% found this document useful (0 votes)
13 views

k

The document outlines a trading strategy called 'BarUpDn Strategy' that utilizes various indicators and conditions to determine entry points for long and short positions based on price movements. It includes parameters for maximum intraday loss, moving averages, and candle color coding for visual representation. Additionally, it implements logic for identifying bullish and bearish engulfing patterns and plots shapes on the chart to indicate buy and sell signals.

Uploaded by

jdjdkririr0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

k

The document outlines a trading strategy called 'BarUpDn Strategy' that utilizes various indicators and conditions to determine entry points for long and short positions based on price movements. It includes parameters for maximum intraday loss, moving averages, and candle color coding for visual representation. Additionally, it implements logic for identifying bullish and bearish engulfing patterns and plots shapes on the chart to indicate buy and sell signals.

Uploaded by

jdjdkririr0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

strategy("BarUpDn Strategy", overlay=true, default_qty_type =

strategy.percent_of_equity, default_qty_value = 10)


maxIdLossPcnt = input.float(1, "Max Intraday Loss(%)")
strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)
if (close > open and open > close[1])
strategy.entry("BarUp", strategy.long)
if (close < open and open < close[1])
strategy.entry("BarDn", strategy.short)
//plot(strategy.equity, title="equity", color=color.red, linewidth=2,
style=plot.style_areabr)

endencia",
emab_per = input {default = "100", type = input.string}
}

input_group {
"Media Rapida",
emac_per = input {default = "3", type = input.string}
}

input_group {
"Media Lenta",
emad_per = input {default = "13", type = input.string}
}

input_group {
"Venda",
vender_color = input {default = "#fcf805", type = input.color}
}

input_group {
"Candles",
positivo = input { default = "#0bd104",type = input.color },
neutro = input { default = "#F7FB3A", type = input.color },
negativo = input { default = "#f70202", type = input.color },
}

--PARAMETROS

EMAA = ema(close,emaa_per)
EMAB = ema(close,emab_per)
EMAC = ema(hlc3,emac_per)
EMAD = ema(hlc3,emad_per)
upper = highest (high, doch_time)
lower = lowest (low, doch_time)

--CALCULOS

TA = ((close > close[1]) and (close > EMAA) and (EMAA > EMAA[1]))
TB = ((close < close[1]) and (close < EMAA) and (EMAA < EMAA[1]))
ENC = ((EMAC[1] < EMAD[1]) and (EMAC > EMAD))
ENV = ((EMAC[1] > EMAD[1]) and (EMAC < EMAD))

sec = security (current_ticker_id, "1m")


if sec then

local bar_color
if (TA == true) then
bar_color = positivo
elseif (TB == true) then
bar_color = negativo
else
bar_color = neutro
end

plot_candle (open, high, low, close, "ES", bar_color)


plot (upper, "Resistencia", upline_color)
plot (lower, "Suporte",lowline_color)
end

input_group { "CALL - UP COLOR", call_color = input { default="#0bd104", type =


input.color } }
input_group { "PUT - DOWN COLOR", put_color = input { default="#f70202", type =
input.color } }

if ((close[1] < open[1]) and (close > open) and (close > high[1]) and close[2] >=
open) then

plot_shape(1,
'Bull_Engulfing',
shape_style.circle,
shape_size.huge,
call_color,
shape_location.belowbar,
0,
"ing",
"#fcfc03"
)
else
if ((close[1] > open[1]) and (close < open) and (close < low[1]) and close[2]
<= open) then

plot_shape(1,
'Bear_Engulfing',
shape_style.circle,
shape_size.huge,
put_color,
shape_location.abovebar,
0,
"ing",
"#fcfc03"
)
end
end

input_group { "UP - UP COLOR", call_color = input { default="#0bd104", type =


input.color } }
input_group { "DOWN - DOWN COLOR", put_color = input { default="#f70202", type =
input.color } }

if ((close > close[1]) and (close[1] > open[2]) and (close[3] > close[2])) then

plot_shape(1,
'Bull_UP',
shape_style.arrowup,
shape_size.huge,
call_color,
shape_location.belowbar,
0,
"OK",
"#fcfc03"
)
else
if ((close < close[1]) and (close[1] < open[2]) and (close[3] < close[2])) then

plot_shape(1,
'Bear_DOWN',
shape_style.arrowdown,
shape_size.huge,
put_color,
shape_location.abovebar,
0,
"OK",
"#fcfc03"
)
end
end

instrument { name = "Cycle Pro V2", overlay = true, icon="indicators:ATR" }

c1 = close[1] < open[1] and close > open


c2 = close > open[1]
c3 = lowest(low,3) < lowest (low,50)[1] or lowest(low,3) < lowest(low,50)[2] or
lowest(low,3) < lowest(low,50)[3]
buy = c1 and c2 and c3

c4 = close[1] > open[1] and close < open


c5 = close < open[1]
c6 = highest(high,3) > highest (high,50)[1] or highest(high,3) > highest(high,50)
[2] or highest(high,3) > highest(high,50)[3]
sell = c4 and c5 and c6

plot_shape(buy, "long", shape_style.arrowup, shape_size.huge, '#0bd104',


shape_location.belowbar,0,'100%', '#fcfc03')
plot_shape(sell , "short", shape_style.arrowdown, shape_size.huge, '#f70202',
shape_location.abovebar,0,'100%', '#fcfc03')

instrument { name = "Cycle Pro V2", overlay = true }


percentage = input (2, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#37FA0A", type = input.color },
down_color = input { default = "#FCA800", type = input.color },
width = input { default = 6, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.area, na_mode.continue)
plot(pivot, 'ZZ', color, width, -1, style.dash_line, na_mode.continue)

instrument { name = " Cycle Pro V2", overlay = true }


percentage = input (2, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "rgba(255, 138, 20, 0.36)", type = input.color },
down_color = input { default = "rgba(0, 253, 8, 0.36)", type = input.color },
width = input { default = 1, type = input.line_width }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.area, na_mode.continue)e))ntinue)e)

You might also like