Skip to content
← Indicator library
tradingviewmomentumstrategypinescript-v6

RSI 50 Long-Only ATR Strategy

A long-only Pine Script v6 strategy that enters above RSI 50 and manages positions with ATR-based stops and targets.

Published by AlgoNexa. AlgoNexa builds and documents evidence-first trading tools so you can inspect the logic before using it.About AlgoNexaIndicator library
Published Aug 9, 2026#rsi#atr#long-only#strategy#risk-management#pinescript-v6#tradingview

How it works

Read the logic before you use it.

1

When it signals

The strategy submits a long entry when `RSI(14)` is above 50. Its short condition is permanently false, so it does not sell short.

2

How positions are managed

While a long position is open, it places a stop at 1.5 × `ATR(14)` below average entry and a limit target at 3 × `ATR(14)` above average entry.

3

How risk is framed

The configured target distance is twice the configured stop distance, based on ATR multiples rather than a fixed percentage. The strategy also models a 0.1% commission in TradingView.

Walkthrough

Watch how it reads the chart.

Live market chart

The logic on real candles.

Backtest evidence

What the numbers actually show.

E0 · Reconstructed reference

algonexta-reference · Yahoo Finance · EURUSD · 1h

Net profit

0.0161

Max drawdown

0.0078

Trades

29

Symbol · TF

EURUSD · 1h

Equity curve

Reference trades (58)
TimeSidePrice
Jun 11, 12:00 PMlong1.15433
Jun 11, 01:00 PMexit1.15253
Jun 11, 05:00 PMlong1.15553
Jun 14, 11:00 PMexit1.15915
Jun 16, 07:00 AMlong1.15982
Jun 17, 04:00 AMexit1.16166
Jun 19, 12:00 PMlong1.14745
Jun 22, 03:00 AMexit1.14612
Jun 25, 02:00 AMlong1.13662
Jun 25, 07:00 AMexit1.13520
Jun 25, 08:00 AMlong1.13701
Jun 25, 10:00 AMexit1.13535
Jun 25, 01:00 PMlong1.13649
Jun 26, 08:00 AMexit1.13996
Jun 26, 06:00 PMlong1.13908
Jun 29, 02:00 PMexit1.14239
Jun 30, 02:00 PMlong1.14364
Jun 30, 04:00 PMexit1.14157
Jul 2, 06:00 AMlong1.13986
Jul 2, 12:00 PMexit1.14563
Jul 6, 04:00 PMlong1.14338
Jul 7, 07:00 PMexit1.14201
Jul 8, 05:00 AMlong1.14233
Jul 8, 09:00 AMexit1.14072
Jul 8, 04:00 PMlong1.14168
Jul 9, 06:00 AMexit1.14433
Jul 9, 11:00 AMlong1.14325
Jul 10, 02:00 AMexit1.14590
Jul 10, 03:00 PMlong1.14416
Jul 10, 05:00 PMexit1.14255
Jul 13, 07:00 AMlong1.14273
Jul 13, 02:00 PMexit1.14082
Jul 14, 08:00 AMlong1.14038
Jul 14, 12:00 PMexit1.14519
Jul 15, 08:00 AMlong1.14273
Jul 15, 11:00 AMexit1.14143
Jul 17, 06:00 AMlong1.14534
Jul 17, 08:00 AMexit1.14418
Jul 17, 07:00 PMlong1.14443
Jul 19, 11:00 PMexit1.14316
Jul 20, 02:00 AMlong1.14443
Jul 20, 09:00 AMexit1.14323
Jul 21, 06:00 AMlong1.14260
Jul 21, 01:00 PMexit1.14162
Jul 22, 05:00 AMlong1.14129
Jul 23, 02:00 AMexit1.14309
Jul 24, 07:00 AMlong1.13934
Jul 24, 11:00 AMexit1.13799
Jul 26, 11:00 PMlong1.13986
Jul 27, 12:00 PMexit1.13846
Jul 28, 02:00 PMlong1.13895
Jul 29, 06:00 PMexit1.14361
Jul 31, 02:00 PMlong1.15088
Aug 4, 06:00 PMexit1.15364
Aug 6, 11:00 AMlong1.15487
Aug 6, 02:00 PMexit1.15373
Aug 7, 11:00 AMlong1.15367
Aug 7, 12:00 PMexit1.15704

Executed from the versioned AlgoNexta IR on the same OHLC dataset used by the chart.

This is an independent reference backtest; TradingView Strategy Tester remains the official comparison.

This is an AI-reconstructed approximation of the script’s logic, not an execution of the exact source — verify the real script in TradingView Strategy Tester.

Vision Grade

What was measured, and how confident we are in it.

Vision Grade requires a reference backtest with enough reconstructed entries to measure — not available for this script yet.

Full breakdown

How the script behaves.

About AlgoNexta

Published by AlgoNexta, an evidence-first platform for building, reviewing, and documenting algorithmic trading tools. This page explains the script's actual logic and intended use; it does not promise profitability or replace verification in TradingView.

What it does

This is a long-only TradingView strategy built around the 14-period RSI. It opens a long position when ta.rsi(close, 14) > 50; the short condition is explicitly set to false, so it never opens short trades.

Once a long position exists, the strategy calculates a 14-period ATR and places a dynamic stop 1.5 ATR below the average entry price. Its profit target is 3 ATR above the average entry price, which is a 2:1 target-to-risk distance at entry.

Conditions it watches

  • Long entry: RSI(14) > 50.
  • Short entry: None. shortCondition = false.
  • Long stop: strategy.position_avg_price - ATR(14) × 1.5.
  • Long target: strategy.position_avg_price + ATR(14) × 3.
  • Pyramiding: Set to 0, so the strategy is not designed to stack multiple same-direction entries.
  • Commission setting: The script includes commission_value=0.1 percent in its Strategy Tester configuration.

How to read it

Because this is a strategy, TradingView shows its native entry and exit markers on the price chart and records trades in the Strategy Tester. There are no custom lines, colored candles, labels, dashboard panels, or alert conditions coded in this version.

A long marker represents an RSI-above-50 entry. Exit markers represent either the ATR-based stop or the ATR-based limit target being reached. The stop and target are recalculated from the position's average entry price using the current ATR(14) value.

Markets and timeframes

The code does not specify a market, session, or preferred timeframe. It can be applied to any TradingView symbol and chart interval that has sufficient price history for RSI and ATR calculations. Test each market and timeframe independently, since ATR distances and RSI behavior vary with volatility and bar size.

Limitations

  • This is not a complete market-regime, trend-filter, or short-selling system; its only entry filter is whether RSI(14) is above 50.
  • It does not detect chart patterns, support/resistance, divergence, volume confirmation, or news events.
  • No alertcondition() calls are included, so the script does not define custom indicator alerts.
  • The script does not use higher-timeframe request.security() data or future-looking references. However, strategy fills and results should be checked in TradingView's Strategy Tester; process_orders_on_close=false means orders are not configured to process on the signal bar's close.
  • ATR-based exits can move as ATR changes, so historical trade behavior should be reviewed rather than assuming a fixed cash or percentage risk amount.

This script is for analysis and testing, not financial advice. Use TradingView Strategy Tester and forward testing as the source of truth for results on your chosen symbol and timeframe.

Source

pinescript-v6 · full source

this-pine-script-code-is-subject-to-the-terms-of-the-mozilla-public-license.pine
// ============================================================================
// © algonexta
// This script is for education and research; it does not guarantee results.
// Verify this source in TradingView before use.
// ============================================================================

//@version=6
strategy("This Pine Script code is subject to the terms of the Mozilla Public License", overlay=true, pyramiding=0, commission_type=strategy.commission.percent, commission_value=0.1, process_orders_on_close=false)

// Generated with AlgoNexta Pine Studio
// https://algonexta.com
// Pine Script v6 — verify in TradingView before use.
// Generated deterministically from approved AlgoNexta strategy IR.
longCondition = ta.rsi(close, 14) > 50
shortCondition = false
if longCondition
    strategy.entry("Long", strategy.long)
if shortCondition
    strategy.entry("Short", strategy.short)
atrStop = ta.atr(14)
longStop = strategy.position_avg_price - atrStop * 1.5
shortStop = strategy.position_avg_price + atrStop * 1.5
if strategy.position_size > 0
    strategy.exit("Long Exit", "Long", stop=longStop, limit=strategy.position_avg_price + atrStop * 3)
if strategy.position_size < 0
    strategy.exit("Short Exit", "Short", stop=shortStop, limit=strategy.position_avg_price - atrStop * 3)
// Generation: AlgoNexta compiler-v17 · 8bde37036ea9

FAQ

Common questions.

What triggers a long trade?

The strategy enters long when the 14-period RSI is above 50: `ta.rsi(close, 14) > 50`. It has no additional trend, volume, or price-pattern confirmation.

Does this strategy take short trades?

No. The code sets `shortCondition = false`, so no short entries can be generated.

How are the stop-loss and profit target calculated?

For long positions, the stop is 1.5 times `ATR(14)` below the average entry price and the limit target is 3 times `ATR(14)` above it. This creates a 2:1 target-to-risk distance based on those ATR multiples.

Does it repaint or use future data?

The code contains no higher-timeframe requests, lookahead settings, or future-bar references. Still, review fills in Strategy Tester because the strategy is configured with `process_orders_on_close=false`, and live execution can differ from historical assumptions.

Does it place trades or send alerts?

It is a TradingView strategy and uses `strategy.entry()` and `strategy.exit()` for simulated Strategy Tester orders. It does not include `alertcondition()` calls or custom alert logic.

Is this financial advice, and where should I verify results?

No. This script is not financial advice; TradingView Strategy Tester, plus forward testing on the intended market and timeframe, is the source of truth for its simulated and live results.

Want a version tuned to your market?

Describe the change in plain English and AlgoNexta rebuilds it as a fresh Pine v6 script — with its own explanation, evidence, and walkthrough.

Build your own version

Educational content only — not financial advice. TradingView is the source of truth for live data, compilation, and Strategy Tester results.