Skip to main content
On this page

Best Strategy on TradingView: Build and Compare Testable Rules

· 7 min read
Pineify Team
Pine Script and AI trading workflow research team

The best TradingView strategy for a particular task is one whose rules, execution assumptions, and risks can be evaluated. A MACD/RSI combination does not have an inherent win rate, and a timeframe does not come with a return target. Start with one testable hypothesis, then compare it with a simpler baseline under identical conditions.

TradingView strategy research and chart analysis

Choose the Behavior You Want to Test​

Different strategy families make different assumptions about prices. Selecting a family is more useful than collecting indicators until a historical chart looks convincing.

FamilyHypothesisExample trigger to investigatePrincipal failure mode
Trend followingDirectional moves can persistClose crosses above a moving averageRepeated losses in a range
Pullback continuationA temporary retracement can resolve with the trendMomentum recovers while a trend filter remains positiveA pullback becomes a trend reversal
Mean reversionA deviation from a reference can narrowPrice returns inside a volatility bandA sustained move overwhelms the reference
BreakoutPrice can continue beyond a recent rangeClose exceeds the previous range highFalse breaks and costly execution

These are hypotheses, not ranked recommendations. Several indicators can express the same price information; adding MACD, moving averages, and another trend oscillator does not create three independent pieces of evidence.

A Complete MACD/RSI Research Example​

The following long-only example is deliberately specified so it can be implemented and challenged. No performance result is claimed for these settings.

  • Calculate MACD with lengths 12, 26, and 9, and RSI with length 14, on standard candles.
  • On a completed bar, require the MACD line to be above its signal line and RSI to cross upward through 50.
  • Submit an entry only when flat. Model the entry at the next bar's open; do not assume a fill at a close already used to make the decision.
  • Store ATR(14) from the signal bar. Use an initial stop two times that value below the actual entry, and a target three times that value above the entry.
  • Keep those levels fixed for the experiment. Do not pyramid or reverse. Ignore new entries until the position closes.
  • Specify commissions, slippage, and the handling of gaps and bars that touch both exit levels.

MACD and RSI defaults are reference settings, not optimized values. TradingView's MACD documentation and RSI documentation explain their calculations. A different RSI threshold, trend filter, or trailing stop produces a different strategy and should receive a separate experiment ID.

Size Risk Before Comparing Returns​

For a cash instrument with a value of one currency unit per price point, a basic planned position size is risk budget / entry-to-stop distance, rounded down to the permitted quantity increment. Futures and other contracts require their point value; currency conversion may also be necessary.

For example, a hypothetical $100 risk budget with a $2 stop distance permits 50 shares before allowing for fees and slippage. A gap through the stop can exceed the planned loss. Apply a separate capital or leverage limit so a narrow stop does not create an unaffordable position.

Keep the sizing method identical across strategy candidates. Comparing a leveraged system with an unleveraged baseline mostly measures a difference in exposure.

Run the TradingView Test​

Add a strategy script, rather than just an indicator, to the chart. TradingView strategies simulate orders and provide a strategy report. Configure the chart symbol, timeframe, date range, initial capital, order size, commission, and slippage, then save them with the result. Use standard price candles for the baseline. See TradingView's strategy documentation for the emulator's fill assumptions.

Inspect individual trades before trusting the summary. Check that a signal precedes its fill, a stop exists when expected, and position size is consistent with the specification. Investigate a small selection of losing trades and gap events, not only the largest winners.

Pineify provides a visual strategy builder that generates Pine Script from configured conditions and orders. The generated script still needs to be checked against your written rules and tested in TradingView. Code generation does not establish profitability or make a simulated fill executable.

Compare Evidence, Not Headline Returns​

Use a record like this for every candidate:

MeasureWhat it helps answer
Net return and matched baselineDid the rules add value beyond their market exposure?
Average net profit per tradeIs the apparent margin large enough relative to costs?
Win rate and average win/lossWhat combination produces the overall result?
Maximum drawdown and recovery durationWhat loss and waiting period occurred in the sample?
Trade count and time in marketHow much evidence and exposure produced the result?
Results by time period and directionIs performance concentrated in one favorable segment?

Define a training period for rule selection and a later evaluation period before running comparisons. A single strong year does not demonstrate stability; a long sample can also hide deterioration. Inspect both the full series and its segments.

Change one design choice at a time. For example, compare the MACD/RSI strategy with the same RSI trigger and exits but without the MACD filter. This reveals what the additional condition contributes. It also prevents attributing a change in position sizing or exit logic to the indicator itself.

Timeframes and Higher-Timeframe Filters​

A 15-minute chart can generate more trades and cost exposure than a daily chart, while a daily position can face overnight gaps. Measure both rather than attaching a generic return potential to either.

If a lower-timeframe entry uses a higher-timeframe filter, decide whether the filter uses the last completed higher-timeframe bar. A value from an unfinished bar can change before it closes and differ after the chart reloads. TradingView explains this issue in its repainting documentation.

Move From Simulation to Observation​

Freeze a version of the rules and record prospective signals with their timestamps. Compare intended entry prices with paper fills or executable quotes, and note missed signals and rejected orders. This measures a different question from historical profitability: whether the workflow behaves as specified as new data arrives.

Set review criteria before observing results. A single loss does not invalidate a strategy, and a short winning streak does not justify increasing exposure. If you change the rules, begin a new record rather than mixing versions into one track record.

Frequently Asked Questions​

Is MACD plus RSI the best TradingView strategy?

That cannot be established from the indicator names. Complete entry, exit, sizing, and cost rules are needed, followed by comparison with a baseline on data not used for tuning.

How much history should I backtest?

Use enough data to examine the strategy's trade frequency and several relevant market conditions. A fixed number of years is not sufficient by itself, particularly for a strategy that trades rarely.

Does a strategy alert place a real order?

A simulated strategy order and an alert do not by themselves establish a live broker order. Any execution connection needs its own setup, permissions, and verification.

What should I optimize first?

First verify that the script implements the intended rules. Then evaluate a limited, recorded set of changes, preserving an untouched evaluation period. Optimizing a faulty simulation only makes the error harder to notice.