The rules at a glance
- Indicators: the 14-period RSI and a 50-period EMA as the trend filter
- Long: the RSI closes above 60 (from at or below 60) with the price above the 50 EMA
- Short: the RSI closes below 40 (from at or above 40) with the price below the 50 EMA
- Stop loss: 1.5 × the 14-period ATR from the entry, or the last 10 candles' swing
- Exit: the stop, a 2R target, or early if the RSI closes back below 40 (for a long) or above 60 (for a short)
What the RSI measures
The Relative Strength Index, created by J. Welles Wilder and published in 1978, compares the size of recent up-moves with recent down-moves and scales the result from 0 to 100. Above 50, gains have outweighed losses over the period; below 50, losses have. The standard setting is 14 periods.
Most beginners learn the RSI as an overbought and oversold indicator: sell above 70, buy below 30. In a strong trend, that means trading against the move, and the RSI can stay above 70 or below 30 for a long time. The 60/40 approach uses the RSI the other way round, as a measure of momentum to go with.
Why 60 and 40?
Andrew Cardwell taught that the RSI behaves differently in trends: in an uptrend it tends to stay roughly between 40 and 80, dipping to around 40 on pullbacks rather than to 30, and in a downtrend roughly between 20 and 60. Constance Brown gave slightly wider ranges in her 1999 book Technical Analysis for the Trading Professional: about 40 to 90 in uptrends and 10 to 60 in downtrends. This is often called an RSI range shift.
The 60/40 strategy builds on that. A move up through 60 suggests momentum has turned bullish strongly enough to matter. As long as the RSI holds above 40, the uptrend's character is intact; a fall below 40 says it has changed. The same works in reverse for shorts. The numbers aren't magic, and the script lets you try 55/45 or 65/35, but they give clear, testable levels.
The rules, step by step
1. Check the trend
Only buy when the price is above the 50 EMA, and only sell when it's below. The filter keeps you from buying RSI pops in a falling market.
2. Wait for the RSI to close above 60
The signal is a candle that closes with the RSI above 60 after the previous close had it at or below 60. A brief move above 60 during the candle doesn't count.
3. Place the stop
The default stop is 1.5 × the 14-period ATR below the entry. The other choice in the script is the lowest low of the last 10 candles.
4. Exit at 2R, or early if momentum flips
The target is twice the risk. If the RSI closes back below 40 before that, the trade is closed early: the momentum that justified it has gone. If that same candle is also a short signal (RSI below 40 with the price under the 50 EMA), the script reverses into a short instead of only closing, and it does that even with the early exit switched off.
5. Mirror it for shorts
RSI closes below 40, price below the 50 EMA: sell, with the stop 1.5 × ATR above and an early exit if the RSI closes back above 60.
Worked example: XAUUSD, 1-hour chart
50 EMA
Gold has been rising, then spends most of a day moving sideways, holding above or just on the 50 EMA. Notice that during the pause the RSI stays above 40: the uptrend hasn't lost its character. Then a strong hourly candle closes at 4,350.0 and the RSI jumps from 55 to 67, through 60. The price is above the 50 EMA, so that's a long signal. The ATR is $16.66, so the stop goes 1.5 × ATR, about $25, below the entry.
| XAUUSD long | |
|---|---|
| Entry | 4,350.00 |
| Stop loss (1.5 × ATR) | 4,325.00, $25.00 away |
| Target (2R) | 4,400.00, $50.00 away |
| Account and risk | $10,000, risking 1% = $100 |
| Lot size | $100 ÷ ($25.00 × 100 ounces) = 0.04 lots |
| Loss if the stop is hit | $100.00 |
| Profit at the target | $200.00 |
The RSI stays above 66 the whole way, so the early exit never triggers, and the target is reached 10 hours after the entry. A $25 stop on gold is wide for intraday trading, which is why the position is only 0.04 lots. On a quieter day the ATR is smaller, the stop tighter and the position bigger, for the same $100 of risk.
RSI 60/40 on Nifty and stocks
Many Indian traders use 60/40 on the Nifty, Bank Nifty and stock charts, often on the daily or 1-hour timeframe. The script runs on those charts because it doesn't use pips: the stop is in ATR, and the size comes from your risk percentage. It doesn't round to whole lots and starts with $10,000, though, so for futures change the capital and currency under Properties and check what one lot risks at your stop. The opening range breakout guide shows that calculation for Nifty futures.
Other indicator strategies with free scripts: the MACD and 200 EMA and the Bollinger Bands squeeze.
Risk management
- Size from the ATR stop. When the market is fast, the stop is wider and the position smaller. That's the point.
- Expect whipsaws in ranges. In a sideways market, the RSI can cross 60 and fall back below 40 again and again. The trend filter helps, but doesn't remove them.
- Watch the news. A data spike can push the RSI through 60 in one candle and reverse in the next. See the economic calendar.
- Mind the swap on longer holds. On the 1-hour and 4-hour charts, trades can last days. The swap calculator shows what holding gold or forex overnight costs.
Two other ways to use the RSI, each with a free script: buying sharp dips with a 2-period RSI in the EMA and RSI strategy, and trading turns with RSI divergence.
Common mistakes
- Mixing the two RSI styles. Buying above 60 and then selling at 70 "because it's overbought" throws away the trades the strategy is built for.
- Acting before the candle closes. The RSI moves with every tick until the candle closes.
- Ignoring the trend filter. A cross above 60 in a downtrend is often a short-lived bounce.
- Changing the levels after every loss. Test 60/40 and one or two alternatives properly, then pick one.
The Traders Dynamic Index is another way to read RSI momentum, with smoothing and volatility bands. And the 9 and 21 EMA crossover is a similar trend-following idea built from moving averages.
Backtest it yourself on TradingView
This page doesn't quote a win rate or a profit figure, and you should be wary of anyone who does without showing the test. Results change with the market, the dates, the data feed and the costs you put in. The honest way is to run the test yourself, and the free script below does the work in a couple of minutes.
- Open the chart. On TradingView, open XAUUSD on the 1-hour chart.
- Add the script. Open the Pine Editor from the Pine icon in the panel on the right of the chart (older layouts have it as a tab under the chart), delete the code that's already there, paste this strategy's code and click "Add to chart".
- Put in your costs. Open the strategy's settings and go to Properties. Enter your broker's commission and a little slippage. A test without costs flatters every strategy, and short-term ones most of all.
- Read the Strategy Tester. The panel under the chart shows the net profit, the maximum drawdown, the profit factor, the number of trades and a list of every trade. Click a few trades and check on the chart that each one follows the rules. Trade sizes are shown in units rather than lots: 100,000 units is one lot of a forex pair, and 100 ounces is one lot of gold.
- Change one setting at a time. Compare the early RSI exit on and off first. Then try the ATR stop against the swing stop, the 2R target against 1.5R and 3R, 55/45 and 65/35 levels, and the 50 EMA filter on and off. Run the same settings on EURUSD and on the Nifty's daily chart.
As a rough guide, don't trust a result with fewer than 100 trades, a profit factor under 1 once costs are in, or a drawdown you couldn't sit through with real money. Settings tuned to look good on one stretch of history often fail on the next, so check the same settings on dates you didn't tune them on, then demo trade the strategy for a few weeks. How much history you can test depends on your TradingView plan: the free plan loads 5,000 candles, which is a few months of 15-minute candles but years of daily ones.
The script sizes each trade from the stop loss and your risk percentage, starts with $10,000 and assumes 1:100 leverage (a 1% margin setting), so the tester doesn't flag margin calls on normal forex trade sizes. Change these under Properties to match your account. By default TradingView fills orders at the open of the candle after the signal, so the fill can differ a little from the signal candle's close.
Download the free Pine Script and PDF
The script is written in Pine Script version 6 for this guide and follows the rules above. It can't read the economic calendar, so skipping news days is up to you. It's free to use, change and share. The PDF is a one-page cheat sheet with the rules, a worked example, the lot size maths and a checklist, to keep next to your chart.
Show the code (Pine Script v6, 66 lines)
//@version=6
// RSI 60/40 strategy by PipLedger (https://pipledgerfx.com/rsi-60-40-strategy)
// Buys when the RSI moves up through 60 with the price above the 50 EMA, sells when it moves down through 40 below it.
// Exits at the stop, at the target, or early if the RSI crosses back through the other level.
// Free to use and change. For education and backtesting only; not financial advice.
strategy("PipLedger: RSI 60/40", shorttitle="RSI 60/40", overlay=false, initial_capital=10000, pyramiding=0, default_qty_type=strategy.fixed, default_qty_value=1, margin_long=1, margin_short=1, currency=currency.USD)
// ---------- Inputs
rsiLen = input.int(14, "RSI length", minval=2)
upLvl = input.float(60, "Bullish level", minval=50, maxval=90)
dnLvl = input.float(40, "Bearish level", minval=10, maxval=50)
useTrend = input.bool(true, "Only trade in the direction of the trend EMA")
trendLen = input.int(50, "Trend EMA", minval=5)
stopType = input.string("ATR", "Stop loss", options=["ATR", "Swing"])
atrMult = input.float(1.5, "ATR multiple (for the ATR stop)", minval=0.1, step=0.1)
swingBars = input.int(10, "Swing lookback (bars, for the swing stop)", minval=2)
rr = input.float(2.0, "Target (R multiple)", minval=0.5, step=0.25)
rsiExit = input.bool(true, "Exit early if the RSI crosses back through the other level")
riskPct = input.float(1.0, "Risk per trade (% of equity)", minval=0.1, maxval=5.0, step=0.1)
// ---------- Helpers
fx = strategy.convert_to_account(1.0) // one unit of the chart's quote currency in account currency (1 on USD-quoted charts)
calcQty(float entry, float stop) =>
float dist = math.abs(entry - stop)
dist > 0 and not na(fx) ? strategy.equity * riskPct / 100 / (dist * syminfo.pointvalue * fx) : 0.0
rsi = ta.rsi(close, rsiLen)
emaT = ta.ema(close, trendLen)
atr = ta.atr(14)
lowSw = ta.lowest(low, swingBars)
highSw = ta.highest(high, swingBars)
upX = ta.crossover(rsi, upLvl) // RSI moves up through 60
dnX = ta.crossunder(rsi, dnLvl) // RSI moves down through 40
longSig = upX and (not useTrend or close > emaT)
shortSig = dnX and (not useTrend or close < emaT)
longSl = stopType == "ATR" ? close - atr * atrMult : lowSw
shortSl = stopType == "ATR" ? close + atr * atrMult : highSw
longQty = calcQty(close, longSl)
shortQty = calcQty(close, shortSl)
longGo = longSig and longSl < close and longQty > 0
shortGo = shortSig and shortSl > close and shortQty > 0
// ---------- Early exits (skipped when the same candle opens a trade the other way: that reverses the position)
if rsiExit
if dnX and strategy.position_size > 0 and not shortGo
strategy.close("Long", comment="RSI back below " + str.tostring(dnLvl))
if upX and strategy.position_size < 0 and not longGo
strategy.close("Short", comment="RSI back above " + str.tostring(upLvl))
// ---------- Entries (an entry against an open trade reverses it)
if longGo and strategy.position_size <= 0
strategy.entry("Long", strategy.long, qty=longQty)
strategy.exit("Long exit", "Long", stop=longSl, limit=close + (close - longSl) * rr)
if shortGo and strategy.position_size >= 0
strategy.entry("Short", strategy.short, qty=shortQty)
strategy.exit("Short exit", "Short", stop=shortSl, limit=close - (shortSl - close) * rr)
// ---------- Chart: the RSI in its own pane, the trend EMA and signals on the price chart
plot(rsi, "RSI", color=color.new(color.purple, 0), linewidth=2)
hline(upLvl, "Bullish level", color=color.new(color.teal, 0), linestyle=hline.style_dashed)
hline(50, "50", color=color.new(color.gray, 50), linestyle=hline.style_dotted)
hline(dnLvl, "Bearish level", color=color.new(color.red, 0), linestyle=hline.style_dashed)
plot(useTrend ? emaT : na, "Trend EMA", color=color.new(color.orange, 0), force_overlay=true)
plotshape(longGo, "Long", shape.triangleup, location.belowbar, color.teal, size=size.small, force_overlay=true)
plotshape(shortGo, "Short", shape.triangledown, location.abovebar, color.red, size=size.small, force_overlay=true)Trading this from India
The rules work on any gold chart, and TradingView's XAUUSD chart is a fine place to learn and backtest them. To trade gold legally from India, though, use MCX gold futures, including the smaller Gold Mini and Gold Petal contracts, through a SEBI-registered broker. Trading XAUUSD as a CFD with an offshore forex platform isn't allowed for residents under FEMA. MCX gold trades from 9 a.m. to 11:30 p.m. IST while the US is on daylight saving time and to 11:55 p.m. in the US winter, which covers the London session and the New York morning. The contract is priced in rupees, and the script's stop comes from the ATR, so it needs no pip setting. The full picture is in is forex trading legal in India and XAUUSD market timings in India.
Related strategies: 9 and 21 EMA crossover, MACD and 200 EMA, Bollinger Bands squeeze, VWAP pullback, XAUUSD scalping, ADX trend following, 20 and 50 EMA pullback. All 34 strategies are compared on one page in forex trading strategies.