0% found this document useful (0 votes)
22 views2 pages

Trading Signal Indicator Script

The document outlines a trading script that implements a moving average crossover strategy using fast and slow moving averages to determine buy and sell conditions. It includes user inputs for periods, colors, and visibility for buy and sell signals. The script plots buy and sell signals on a chart based on the defined conditions.

Uploaded by

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

Trading Signal Indicator Script

The document outlines a trading script that implements a moving average crossover strategy using fast and slow moving averages to determine buy and sell conditions. It includes user inputs for periods, colors, and visibility for buy and sell signals. The script plots buy and sell signals on a chart based on the defined conditions.

Uploaded by

Jonas Ribeiro
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

instrument {

name = '01',

short_name = '01',

overlay = true

MaFast_period = input(1,"Ma Fast period",[Link],1,1000,1)

MaValue = input(5,"Ma Value", input.string_selection,[Link])

MaSlow_period = input(34,"Ma Slow period",[Link],1,1000,1)

Signal_period = input(5,"Signal period",[Link],1,1000,1)

input_group {

"Compra",

colorBuy = input { default = "green", type = [Link] },

visibleBuy = input { default = true, type = input.plot_visibility }

input_group {

"Venda",

colorSell = input { default = "red", type = [Link] },

visibleSell = input { default = true, type = input.plot_visibility }

local titleValue = inputs[MaValue]

-- media mvel linear rpida

smaFast = sma(titleValue, MaFast_period)

-- media mvel linear devagar

smaSlow = sma(titleValue, MaSlow_period)

-- calculo diferencial - serie

buffer1 = smaFast - smaSlow

-- calculo 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),

"PROXIMO COMPRAR",

shape_style.triangleup,

shape_size.huge,

colorBuy,

shape_location.belowbar,

-1,

"PROXIMA COMPRAR",

"green"

plot_shape(

(sellCondition),

"PROXIMA VENDER",

shape_style.triangledown,

shape_size.huge,

colorSell,

shape_location.abovebar,

-1,

"PROXIMA VENDER",

"red"

You might also like