1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
79 lines of Pine Script v5 from ALMA-EMA-SRSI Strategy + Indicator.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.
ALMA-EMA-SRSI Strategy + Indicator.pine
//@version=5
////Arranged by @ClassicScott
//Strategy Created by @CheatCode1
strategy('ALMA/EMA Strategy', shorttitle='ALMA/EMA Strategy', overlay=true, margin_long=0, margin_short=0, default_qty_type = strategy.cash, initial_capital = 1000, pyramiding = 0, default_qty_value = 1000, max_bars_back = 100)
////Source Selection & ALMA Variables
//Dominant Momentum ALMA
dsource = input.source(close, title='Source', group='Dominant ALMA')
dperiod = input.int(title='Period', defval=130, group='Dominant ALMA')
doffset = input.float(title='Offset', step=0.025, defval=0.775, group='Dominant ALMA')
dsigma = input.float(title='Sigma', step=0.5, defval=4.5, group='Dominant ALMA')
dalma = ta.alma(dsource, dperiod, doffset, dsigma)
dalma_up_color = input.color(#66bb6a, 'Going Up!', group='Dominant ALMA', inline = '1')
dalma_down_color = input.color(#ef5350, 'Going Down :(', group='Dominant ALMA', inline = '1')
dcolor = close[1] > dalma ? dalma_up_color : dalma_down_color
////ALMA Plots
plot(dalma, color=dcolor, style=plot.style_stepline, linewidth=2, title='Dominant Momentum MA')
//Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1
//Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1 //Strategy by @CheatCode1
cheatcode = input.bool(true, '-----------CHEATC0DE1------------', group = 'Strategy Inputs', confirm = true)
//Variable Declerations/Plot Assingments
inp1 = input.int(49, 'Slow Ema Length', 1, 100, group = 'Strategy Inputs', confirm = true)
inp2 = input.int(9, 'Fast Ema Length', 1, 200, group = 'Strategy Inputs', confirm = true)
inp3 = int(200)
sma1 = ta.sma(close, inp3)
ema1 = ta.ema(close, inp1)
ema2 = ta.ema(close, inp2)
eplot1 = plot(ema1, 'Slow Ema', color.aqua, 1, plot.style_linebr)
eplot2 = plot(ema2, 'Fast Ema', color.yellow, 1, plot.style_linebr)
splot1 = plot(sma1, 'Long MA', close[1] < sma1 ? color.red:color.green, 1, plot.style_line, display = display.none)
cross1 = ta.crossover(ema1, ema2)
cross2 = ta.crossunder(ema1, ema2)
plotchar(cross2, '', '↑', location.belowbar, close[1] > dalma and dalma > sma1 ? na:color.green, size = size.normal, editable = false)
plotchar(cross1, '', '↓', location.abovebar, close[1] < dalma and dalma < sma1 ? na:color.red, size = size.normal, editable = false)
bgcolor(cross1 and close[1] > dalma ? color.new(color.green, 80):cross2 and close[1] < dalma ? color.new(color.red, 80):na)
valueL = ta.valuewhen(cross1 and close[1] > dalma, close, 0)
valueS = ta.valuewhen(cross2 and close[1] < dalma, close, 0)
//Entries
if cross1 and close[2] > dalma[2] and close[1] > dalma[1]
strategy.entry('Long', strategy.long)
if cross2 and close[2] < dalma[2] and close[1] < dalma[1]
strategy.entry('Short', strategy.short)
//StochRsi
smoothK = input.int(3, "K", minval=1)
smoothD = input.int(15, "D", minval=1)
lengthRSI = input.int(14, "RSI Length", minval=1)
lengthStoch = input.int(8, "Stochastic Length", minval=1)
src = input(close, title="RSI Source")
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
//Cancellations
if k > 75
strategy.cancel('Long')
if k < 25
strategy.cancel('Short')
//Closures
if ta.crossunder(k, d) and k > 92
strategy.close('Long')
if ta.crossover(k,d) and k < 8
strategy.close('Short')
//Exit Percents
takeP = input.float(3, title='Take Profit', group = 'Take Profit and Stop Loss') / 100
stopL = input.float(5.49, title = 'Stop Loss', group = 'Take Profit and Stop Loss')/100
// Pre Directionality
Stop_L = strategy.position_avg_price * (1 - stopL)
Stop_S = strategy.position_avg_price * (1 + stopL)
Take_S= strategy.position_avg_price * (1 - takeP)
Take_L = strategy.position_avg_price * (1 + takeP)
//Post Excecution
if strategy.position_size > 0
strategy.exit("Flat", limit=Take_L, stop = Stop_L)
if strategy.position_size < 0
strategy.exit("Flat", limit=Take_S, stop = Stop_S)
Expand (112 lines)
Overview
ALMA/EMA Strategy enters long positions when the moving averages cross while price remains above the ALMA, and enters short positions when price confirms below it. It configures user-defined percentage targets for stop loss and take profit, while also integrating Stochastic RSI settings. Moving averages, the ALMA trendline, and signal markers are plotted directly on the main chart.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Source
source
close
dsource
Period
int
130
dperiod
Offset
float
0.775
doffset
Sigma
float
4.5
dsigma
Going Up!
color
#66bb6a
dalma_up_color
Going Down :(
color
#ef5350
dalma_down_color
-----------CHEATC0DE1------------
bool
true
cheatcode
Slow Ema Length
int
49
inp1
Fast Ema Length
int
9
inp2
K
int
3
smoothK
D
int
15
smoothD
RSI Length
int
14
lengthRSI
Show all 16 settings
Setting
Type
Default
Variable
Stochastic Length
int
8
lengthStoch
RSI Source
source
close
src
Take Profit
float
3
takeP
Stop Loss
float
5.49
stopL
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the
This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can
This strategy combines Arnaud Legoux Moving Average percentage price change calculations with an adaptive Gaussian Moving Average to generate trend-following signals. Long and short entries are triggered when the ALMA change calculation crosses above or below
This strategy generates trading signals based on a selectable momentum engine, supporting MACD, RSI, Stochastic, or Rate of Change. Entries trigger on signal crosses, zero-line crosses, or threshold crosses, with an optional moving average trend filter. Risk m
This strategy evaluates simple moving averages and the Relative Strength Index to generate trading signals. It calculates a 10-period SMA, a 30-period SMA, and a 14-period RSI. Long positions are entered when the fast SMA crosses above the slow SMA while RSI i
This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute