0% found this document useful (0 votes)
41 views5 pages

Script Timelytrading

The document contains the code for multiple trading indicators and scripts: 1) The first section defines an indicator called TIMELYTRADING that includes inputs to configure lines, averages, and fills on a chart. 2) The second defines another called TIEMLYTRADING that implements a moving average crossover strategy using shapes to indicate buy and sell signals. 3) Later sections define additional indicators to plot support and resistance lines based on configurable period lengths and confirmations.

Uploaded by

Henrique Félix
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)
41 views5 pages

Script Timelytrading

The document contains the code for multiple trading indicators and scripts: 1) The first section defines an indicator called TIMELYTRADING that includes inputs to configure lines, averages, and fills on a chart. 2) The second defines another called TIEMLYTRADING that implements a moving average crossover strategy using shapes to indicate buy and sell signals. 3) Later sections define additional indicators to plot support and resistance lines based on configurable period lengths and confirmations.

Uploaded by

Henrique Félix
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/ 5

instrument { name = "TIMELYTRADING", icon="indicators:ADX", overlay = true }

period = input (5, "front.period", input.integer, 1)


shift = input (1, "front.newind.offset", input.double, 0.01, 300, 0.01)
fn = input (averages.ema, "front.newind.average", input.string_selection,
averages.titles)
input_group {
"front.top line",
upper_line_visible = input { default = true, type = input.plot_visibility },
upper_line_color = input { default = "#ff0000", type = input.color },
upper_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.middle line",
middle_line_visible = input { default = true, type = input.plot_visibility },
middle_line_color = input { default = #ffffff, type = input.color },
middle_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.bottom line",
lower_line_visible = input { default = true, type = input.plot_visibility },
lower_line_color = input { default = "#00FF00", type = input.color },
lower_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.newind.adx.fill",
fill_visible = input { default = true, type = input.plot_visibility },
fill_color = input { default = rgba(33,177,144,0.08), type = input.color },
}
local averageFunction = averages [fn]
middle = averageFunction (hlc3, period)
offset = rma(tr, period) * shift
upper = middle + offset
lower = middle - offset
if fill_visible then
fill { first = upper, second = lower, color = fill_color }
end
if upper_line_visible then
plot (upper, "Upper", upper_line_color, upper_line_width)
end
if lower_line_visible then
plot (lower, "Lower", lower_line_color, lower_line_width)
end
if middle_line_visible then
plot (middle, "Middle", middle_line_color, middle_line_width)
end

instrument {
name = 'TIEMLYTRADING',
short_name = 'super',

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 = "green", type = input.color },
visibleBuy = input { default = true, type = input.plot_visibility }
}

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

local titleValue = inputs[MaValue]

-- mdia mvel linear rpida


smaFast = sma(titleValue, MaFast_period)

-- mdia mvel linear devagar


smaSlow = sma(titleValue, MaSlow_period)

-- calculo diferencial - serie


buffer1 = smaFast - smaSlow

-- clculo da mdia mvel ponderada - serie


buffer2 = wma(buffer1, Signal_period)

buyCondition = conditional(buffer1 > buffer2 and buffer1[1] < buffer2[1] and not
(buffer1 < buffer2 and buffer1[1] > buffer2[1]))
buyCondition = conditional(buffer1 > buffer2 and buffer1[1] < buffer2[1])

sellCondition = conditional(buffer1 < buffer2 and buffer1[1] > buffer2[1] and not
(buffer1 > buffer2 and buffer1[1] < buffer2[1]))
sellCondition = conditional(buffer1 < buffer2 and buffer1[1] > buffer2[1] )

plot_shape(
(buyCondition),
"GO",
shape_style.triangleup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
-1,
"COMPRA ",
"green"
)

plot_shape(
(sellCondition),
"GO",
shape_style.triangledown,
shape_size.huge,
colorSell,
shape_location.abovebar,
-1,
"VENDE ",
"red"
)
instrument {
name = 'TIEMLYTRADING',
short_name = 'super',

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 = "green", type = input.color },
visibleBuy = input { default = true, type = input.plot_visibility }
}

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

local titleValue = inputs[MaValue]

-- mdia mvel linear rpida


smaFast = sma(titleValue, MaFast_period)

-- mdia mvel linear devagar


smaSlow = sma(titleValue, MaSlow_period)

-- calculo diferencial - serie


buffer1 = smaFast - smaSlow

-- clculo da mdia mvel ponderada - serie


buffer2 = wma(buffer1, Signal_period)

buyCondition = conditional(buffer1 > buffer2 and buffer1[1] < buffer2[1] and not
(buffer1 < buffer2 and buffer1[1] > buffer2[1]))
buyCondition = conditional(buffer1 > buffer2 and buffer1[1] < buffer2[1])

sellCondition = conditional(buffer1 < buffer2 and buffer1[1] > buffer2[1] and not
(buffer1 > buffer2 and buffer1[1] < buffer2[1]))
sellCondition = conditional(buffer1 < buffer2 and buffer1[1] > buffer2[1] )

plot_shape(
(buyCondition),
"GO",
shape_style.triangleup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
-1,
"COMPRA ",
"green"
)
plot_shape(
(sellCondition),
"GO",
shape_style.triangledown,
shape_size.huge,
colorSell,
shape_location.abovebar,
-1,
"VENDE ",
"red"
)

instrument {name = "S/R 2022", icon = "indicators:ADX", overlay = true}


bar_look = input (3, "Confirmation bars to look", input.integer, 1 )
period1 = input (20, "period Line 1", input.integer, 10 )
period2 = input (50, "period Line 2", input.integer, 10 )
period3 = input (80, "period Line 3", input.integer, 10 )
period4 = input (120, "period Line 4", input.integer, 10 )
period5 = input (150, "period Line 5", input.integer, 10 )
period6 = input (200, "period Line 6", input.integer, 10 )
period7 = input (250, "period Line 7", input.integer, 10 )
period8 = input (300, "period Line 8", input.integer, 10 )
period9 = input (350, "period Line 9", input.integer, 10 )
period10 = input (400, "period Line 10", input.integer, 10 )

input_group {
"Color",
color = input {default = "white", type = input.color},
width = input {default = 1, type = input.line_width}
}
hline(highest(high[bar_look], period1), "HH10", color, width)
hline(lowest(low[bar_look], period1), "LL10", color, width)

hline(highest(high[bar_look], period2), "HH10", color, width)


hline(lowest(low[bar_look], period2), "LL10", color, width)

hline(highest(high[bar_look], period3), "HH10", color, width)


hline(lowest(low[bar_look], period3), "LL10", color, width)

hline(highest(high[bar_look], period4), "HH10", color, width)


hline(lowest(low[bar_look], period4), "LL10", color, width)

hline(highest(high[bar_look], period5), "HH10", color, width)


hline(lowest(low[bar_look], period5), "LL10", color, width)

hline(highest(high[bar_look], period6), "HH10", color, width)


hline(lowest(low[bar_look], period6), "LL10", color, width)

hline(highest(high[bar_look], period7), "HH10", color, width)


hline(lowest(low[bar_look], period7), "LL10", color, width)

hline(highest(high[bar_look], period8), "HH10", color, width)


hline(lowest(low[bar_look], period8), "LL10", color, width)

hline(highest(high[bar_look], period9), "HH10", color, width)


hline(lowest(low[bar_look], period9), "LL10", color, width)

hline(highest(high[bar_look], period10), "HH10", color, width)


hline(lowest(low[bar_look], period10), "LL10", color, width)

instrument{name="Sup/Res
",icon='https://ih1.redbubble.net/image.2665274966.4332/mp,504x516,gloss,f8f8f8,t-
pad,600x600,f8f8f8.jpg',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{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)

You might also like