OPEN-SOURCE SCRIPT

Random Entry Benchmark

144
Can Your Strategy Beat Random Entries?

Most traders spend countless hours searching for the perfect entry signal. But what if random entries could achieve similar results?
Random Entry Benchmark is designed to put your strategy's edge to the test. Instead of relying on indicators, patterns, or market predictions, it generates completely random long-only entries and manages trades using realistic risk controls, including stop losses, risk-reward targets, and position sizing.
In strong markets, even random entries can produce surprisingly respectable returns. A profitable backtest alone does not prove that a strategy has a genuine edge. By running multiple independent simulations and analyzing the distribution of outcomes, this indicator establishes a statistical benchmark for what can be achieved without any predictive entry logic.
If your strategy cannot consistently outperform randomness, does it really have an edge?
The simulator reports key metrics including net return, win rate, average trade return, maximum drawdown, and percentile outcomes, helping separate skill from luck.

Key Features

1. Multiple Simulations Instead of a Single Test
A single random backtest tells very little because luck plays a large role. The simulator performs multiple independent random-entry runs and aggregates the results, providing a Monte Carlo-style view of potential outcomes.
Review key performance metrics across all simulations:
- Net Return
- Win Rate
- Average Trade Return
- Maximum Drawdown
2. Percentile-Based Results
Understand the full distribution of outcomes rather than relying on averages alone.
Typical statistics include:
- 25th Percentile
- Median (50th Percentile)
- 75th Percentile
This helps distinguish normal outcomes from exceptionally lucky or unlucky runs.
3. Realistic Trading Rules
The simulator incorporates common risk management techniques used in actual trading:
- Configurable Stop Loss
- Configurable Risk-Reward Ratio
- Risk-Based Position Sizing
This creates a more realistic benchmark for swing trading and day trading strategies.

How to Use
1. Configure stop-loss and risk-reward settings that closely match your own strategy.
2. Run the simulation and review the statistical results.
3. Compare your strategy's performance against the random-entry benchmark.
4. Determine whether your entry methodology produces results that are meaningfully better than chance.
Note: The simulator currently generates long-only entries, and only one position can be open at a time. The strategy compounds returns by sizing positions based on current account equity (initial capital plus net profit/loss), while limiting risk on each trade according to the Max Risk % setting.

Important!
This indicator does not generate trading signals and is not intended as a trading strategy.
Its purpose is to provide a statistical benchmark against which traders can evaluate the effectiveness of their own entry techniques.

Input Parameters

Execution Period
Start Year / Month – Beginning of the simulation period.
End Year / Month – End of the simulation period.
Only for intraday timeframes:
Trading Hours – Time window during which random entries can be generated.
Time Zone – Timezone used for the trading session.
Close @ COB – Forces all open positions to be closed at the end of the regular trading session.

Strategy Parameters
Initial Capital – Starting account balance used for the simulation.
Max Risk % – Maximum percentage of account equity risked per trade.
STP Type – Method used to calculate stop-loss distance (e.g., ATR-based or fixed % change).
Parameter (M) – Value used by the selected stop-loss method.
ATR: Stop Loss = Entry Candle Low − M × ATR(14)
Change %: Stop Loss = Entry Price × (1 − M/100)
PL Ratio – Profit target expressed as a multiple of the stop-loss distance (Risk/Reward ratio).
Max Bars – Maximum number of bars a trade can remain open before being closed.

Simulation Parameters
Random Seed – Controls the random number sequence used for the first simulation run. Using the same seed reproduces identical results.
Entry Frequency – Average number of random trade entries generated during the simulation period.
Runs # – Number of independent simulation runs. Higher values produce more statistically reliable results.
Low-High % – Lower and upper percentiles displayed in the results. Median values are always shown.

Visuals
Dashboard Position and Size – Position and text size of the results output.
Plot – Selects the performance metric to visualize (Equity, Net Profit, Win Rate, etc.). Trade markers are displayed only for the first simulation run.

Output Results
Total Trades – Number of trades executed during the simulation.
Net Return – Total percentage return generated over the simulation period (Net Profit / Initial Capital).
Win Rate – Percentage of profitable trades.
Avg Return – Average percentage net return per trade.
Max Drawdown – Largest peak-to-trough decline in account equity during the simulation.
Percentiles (25%, 50%, 75%) – Results are reported across all simulation runs:
- 25% – Conservative outcome (75% of runs performed better)
- 50% – Median outcome
- 75% – Favorable outcome (25% of runs performed better)

Known Issues
1. TradingView Execution Limits
Due to TradingView's script execution time limits, the indicator may occasionally fail to complete all simulations, especially when using a long execution period and/or a large number of simulation runs.
In most cases, reducing the amount of historical data or the number of runs will resolve the issue.
2. Intraday Close at COB
On some symbols and timeframes, TradingView does not always allow reliable identification of the final bar of the regular trading session. As a result, positions configured to close at the end of the session may occasionally remain open beyond the intended close and be exited on a later bar.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.