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

Russian Script for EMA and SMA Trading

The document defines a trading script named 'SCRIPT RUSSIAN' that utilizes Exponential Moving Average (EMA) and Simple Moving Average (SMA) for buy and sell signals. It allows user inputs for EMA and SMA periods, as well as candle values, and includes visual elements for buy and sell conditions. The script plots the EMA and SMA values on a chart and indicates buy and sell signals with shapes based on specified conditions.
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)
25 views2 pages

Russian Script for EMA and SMA Trading

The document defines a trading script named 'SCRIPT RUSSIAN' that utilizes Exponential Moving Average (EMA) and Simple Moving Average (SMA) for buy and sell signals. It allows user inputs for EMA and SMA periods, as well as candle values, and includes visual elements for buy and sell conditions. The script plots the EMA and SMA values on a chart and indicates buy and sell signals with shapes based on specified conditions.
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 = 'SCRIPT RUSSIAN',


short_name = 'SCRIPT RUSSIAN',
icon =
'[Link]
overlay = true
}

EMA_PERIOD = input(3,"EMA Period",[Link],1,1000,1)


CANDLE_VALUE = input(1,"Candle Value", input.string_selection,[Link])

SMA_AUX_PERIOD = input(6,"SMA Aux 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 candleValue = inputs[CANDLE_VALUE]

-- Moving Average EMA


emaValue = ema(candleValue, EMA_PERIOD)
input_group {
"[Link] line",
middle_line_visible = input { default = true, type = input.plot_visibility },
middle_line_color = input { default = "aqua", type = [Link] },
middle_line_width = input { default = 1, type = input.line_width }
}

-- Moving Average SMA aux


smaValueAux = sma(candleValue, SMA_AUX_PERIOD)

plot (emaValue, "Middle", middle_line_color, middle_line_width)


plot(smaValueAux, "Middle", middle_line_color, middle_line_width)

BUY_CONDITION = conditional((emaValue > smaValueAux and emaValue > smaValueAux[1])


and (emaValue[1] < smaValueAux and emaValue[1] < smaValueAux[1]))
SELL_CONDITION = conditional((emaValue < smaValueAux and emaValue < smaValueAux[1])
and (emaValue[1] > smaValueAux and emaValue[1] > smaValueAux[1]))

plot_shape(
(BUY_CONDITION),
"CALL",
shape_style.triangleup,
shape_size.auto,
colorBuy,
shape_location.belowbar,
0,
"RUSSIAN BUY",
"green"
)
plot_shape(
(SELL_CONDITION),
"RUSSIAN PUT",
shape_style.triangledown,
shape_size.auto,
colorSell,
shape_location.abovebar,
0,
"SELL",
"red"
)

You might also like