0% found this document useful (0 votes)
39 views3 pages

Pegasus6 6

Uploaded by

Flo Mar
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)
39 views3 pages

Pegasus6 6

Uploaded by

Flo Mar
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

instrument {

name = 'Pegasus @josegomez',


short_name = 'Pesagus @josegomez2000',
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)

exibir_tracamento = input ( 1, "Desea exibir?", input.string_selection,


{"SI","No"})

input_group { "SMAA", smaa_color = input{ default = "#7CFC00", type =


input.color }}
input_group { "SMAB", smab_color = input{ default = "#00FFFF", type =
input.color }}

sec = security(current_ticker_id, "1m")

smab = sma(close, '50')


smabo = sma(open, '50')

plot(smaa, "SMA", smaa_color)


plot(smab, "SMA", smab_color)

emaa = ema(close, '100')

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

source = input (1, "front.ind.source", input.string_selection, inputs.titles)


fn = input (1, "front.newind.average", input.string_selection, averages.titles)

local sourceSeries = inputs [source]


local averageFunction = 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,
"Down",
shape_style.arrowdown,
shape_size.auto,
down_color,
shape_location.abovebar,
0,
" Down ",
1)
end

if
( mad >= 0 and (mad > mad[1]) and (smaa > smab) and close >= emaa and smaao <
smabo)
then
plot_shape (1 ,
"Up",
shape_style.arrowup,
shape_size.auto,
up_color,
shape_location.belowbar,
0,
"Up",
1)

end

input_group {
"COMPRA",
colorBuy = input { default = "#00F900", type = input.color },
visibleBuy = input { default = true, type = input.plot_visibility }
}

input_group {
"VENDA",
colorSell = input { default = "#F90000", type = input.color },
visibleSell = input { default = true, type = input.plot_visibility }
}

local titleValue = inputs[MaValue]

smaFast = sma(titleValue, MaFast_period)

smaSlow = sma(titleValue, MaSlow_period)

buffer1 = smaFast - smaSlow

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),
"COMPRA",
shape_style.arrowup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
-1,
"",
"green"
)

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

You might also like