JMA Crossing RSI Trading Strategy
This strategy generates trading signals by crossing of Jurik Moving Average (JMA) and RSI indicator. It goes long when JMA crosses above RSI and goes short when crossing below. The strategy attempts to filter false…
Overview
This strategy generates trading signals by crossing of Jurik Moving Average (JMA) and RSI indicator. It goes long when JMA crosses above RSI and goes short when crossing below. The strategy attempts to filter false signals by combining two indicators, and trade when trend is more apparent.
Principles
The strategy mainly utilizes two types of indicators:
JMA indicator: A smoothed moving average using power multipliers, with lower lag and quicker in capturing price changes.
RSI indicator: A common strength indicator reflecting buying/selling momentum.
When JMA crosses above RSI, it indicates stronger short-term uptrend over long term trend and generates buy signal. When crossing below RSI, it prompts sell signal.
Upon signal, the strategy enters trade in corresponding direction. Exits when price reaches predetermined profit ratio or indicators cross reverse direction.
Advantages
Adjustable JMA parameters adaptable to different periods.
RSI filters false breakouts.
Dual indicator combination reduces false signals.
Built-in stop loss controls loss.
Customizable profit ratio for profit targeting.
Risks and Mitigations
Dual indicators combo may generate too few signals. Can tweak parameters for sensitivity.
JMA still has lag, may miss turning points. Can optimize with leading indicators.
Improper stop loss placement may be hit for greater loss. Should backtest for suitable placement.
Overreliance on indicators can produce false signals. Can add volume or volatility filters.
Enhancement Opportunities
Test JMA parameters to find optimal settings.
Try different RSI parameters for better performance.
Add trailing stop mechanism for adaptive stops.
Optimize entry position sizing like adding to winning trades.
Research additional filters like KD, MACD.
Summary
The strategy enables trend following with JMA and RSI crossovers and limits risk via stops. But false signals remain probable, requiring further optimization on parameters and filters. Stop loss also needs backtest validation. It provides a basic framework for dual indicator crossing system with room for improvements.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 2019 | Start Year |
| v_input_2 | 6 | Start Month |
| v_input_3 | true | Start Day |
| v_input_4 | false | Start Hour |
| v_input_5 | false | Start Minute |
| v_input_6 | 2019 | End Year |
| v_input_7 | 12 | End Month |
| v_input_8 | true | End Day |
| v_input_9 | false | End Hour |
| v_input_10 | false | End Minute |
| v_input_11 | 14 | Length |
| v_input_12 | 7 | Length |
| v_input_13 | 50 | Phase |
| v_input_14 | 2 | Power |
| v_input_15 | true | Highlight Movements ? |
| v_input_16 | true | Use Initial Stop Loss? |
Source Pine Script
/*backtest
start: 2023-01-01 00:00:00
end: 2023-03-15 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// Stratégie marche le mieux sur du 2 jours
strategy("JMA(7,50,RSI) crossing RSI(14,close)", overlay=false, currency=currency.EUR, default_qty_type=strategy.cash, default_qty_value=5000)
// Strategy Tester Start Time
sYear = input(2019, title = "Start Year")
sMonth = input(06, title = "Start Month", minval = 01, maxval = 12)
sDay = input(01, title = "Start Day", minval = 01, maxval = 31)
sHour = input(00, title = "Start Hour", minval = 00, maxval = 23)
sMinute = input(00, title = "Start Minute", minval = 00, maxval = 59)
startTime = true
// Strategy Tester End Time
eYear = input(2019, title = "End Year")
eMonth = input(12, title = "End Month", minval = 01, maxval = 12)
eDay = input(01, title = "End Day", minval = 01, maxval = 31)
eHour = input(00, title = "End Hour", minval = 00, maxval = 23)
eMinute = input(00, title = "End Minute", minval = 00, maxval = 59)
endTime = true
// === RSI ===
src = close, len = input(14, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
plot(rsi, color=color.purple)
band1 = hline(70)
band0 = hline(30)
// === JMA ===
_length = input(7, title="Length")
_phase = input(50, title="Phase")
_power = input(2, title="Power")
highlightMovements = input(true, title="Highlight Movements ?")
// srcJMA = input(rsi, title="Source")
srcJMA = rsi
phaseRatio = _phase < -100 ? 0.5 : _phase > 100 ? 2.5 : _phase / 100 + 1.5
beta = 0.45 * (_length - 1) / (0.45 * (_length - 1) + 2)
alpha = pow(beta, _power)
jma = 0.0
e0 = 0.0
e0 := (1 - alpha) * srcJMA + alpha * nz(e0[1])
e1 = 0.0
e1 := (srcJMA - e0) * (1 - beta) + beta * nz(e1[1])
e2 = 0.0
e2 := (e0 + phaseRatio * e1 - nz(jma[1])) * pow(1 - alpha, 2) + pow(alpha, 2) * nz(e2[1])
jma := e2 + nz(jma[1])
// === End of JMA def ===
jmaColor = highlightMovements ? (jma > jma[1] ? color.green : color.red) : #6d1e7f
plot(jma, title="JMA switch", linewidth=2, color=jmaColor, transp=0)
// === Inputs ===
// risk management
useStop = input(true, title = "Use Initial Stop Loss?")
goLong() => crossover(rsi, jma)
killLong() => crossunder(rsi, jma)
// ======= DEBUGGGGGGGG ============
long_price = 0.0
short_price = 0.0
if(startTime and endTime)
if(goLong())
long_price := close
strategy.entry("Buy", strategy.long, when = goLong())
strategy.close("Buy", when = killLong() and close > long_price)
// Shorting if using
goShort() => killLong()
killShort() => goLong()
if(startTime and endTime)
if(goShort())
short_price := close
strategy.entry("Sell", strategy.short, when = goShort() and close < short_price)
strategy.close("Sell", when = killShort())
// =========================
if (useStop)
strategy.exit("XLS", from_entry ="Buy", stop = strategy.position_avg_price / 1.08)
strategy.exit("XSS", from_entry ="Sell", stop = strategy.position_avg_price * 1.08)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-18. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/JMA-Crossing-RSI-Trading-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Bollinger Bands Dynamic Breakout StrategyPine Script · Breakout · 1h
- Bull Market Tracking SystemPine Script · Breakout · 1h
- Cross boundary Dynamic Range Quantitative Trading Strategy Based on Bollinger BandsPine Script · Breakout · 3h
- Darvas Box Breakout and Risk Management Strategy DarvasPine Script · Breakout · 1d
- MA Trendline Breakthrough StrategyPine Script · Breakout · 1d
- Momentum Breakout Moving Average StrategyPine Script · Breakout · 1d