Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
37 views4 pages

One Prime

magnos

Uploaded by

Capitan Morsa
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)
37 views4 pages

One Prime

magnos

Uploaded by

Capitan Morsa
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

instrument { name = "ONEPRIME", icon=';', overlay=true }

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 {default=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 = "ONEPRIME", icon="indicators:ADX", overlay = true }


method_id = input (1, "Type", input.string_selection, { "ONEPRIME" })

instrument {
name = 'ONEPRIME',
short_name = 'SCRIPT GO WITH S/R',
icon = 'indicators:BB',
overlay = true
}

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


MaValue = input(5, "Ma Value", input.string_selection, inputs.titles)
MaSlow_period = input(34, "Ma Slow period", input.integer, 1, 1000, 1)
Signal_period = input(5, "Signal period", input.integer, 1, 1000, 1)

input_group {
"Compra",
colorBuy = input { default = "white", type = input.color },
visibleBuy = input { default = true, type = input.plot_visibility }
}

input_group {
"Venda",
colorSell = input { default = "white", type = input.color },
visibleSell = input { default = true, type = input.plot_visibility }
}

local titleValue = inputs[MaValue]

-- Media móvil rápida


smaFast = sma(titleValue, MaFast_period)

-- Media móvil lenta


smaSlow = sma(titleValue, MaSlow_period)

-- Cálculo diferencial - serie


buffer1 = smaFast - smaSlow

-- Cálculo de la media móvil ponderada - serie


buffer2 = wma(buffer1, Signal_period)

buyCondition = conditional(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,
"",
"red"
)

plot_shape(
sellCondition,
"",
shape_style.triangledown,
shape_size.huge,
colorSell,
shape_location.abovebar,
-1,
"",
"red"
)

input_group {
"Maxima",
level_1_color = input { default = "white", type = input.color },
level_1_width = input { default = 2, type = input.line_width }
}

input_group {
"Minima",
level_2_color = input { default = "white", type = input.color },
level_2_width = input { default = 2, type = input.line_width }
}

local function m15(candle)


c1 = candle.high
c2 = candle.low
end

local methods = { m15 }

local resolution = "15m"


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

percentage = input(3, "Percentage", input.double, 0.01, 100, 1.0) / 100


period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#02f7aa", type = input.color },
down_color = input { default = "#f77902", 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.solid_line, na_mode.continue)

You might also like