Expected Value Monte Carlo analyzes historical price returns and projects potential future outcomes directly on the price chart using statistical simulations.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
Expected Value Monte Carlo calculates historical performance metrics over a configurable sample period and simulates future price trajectories based on recent trend and volatility. User settings control the trade duration, position sizing, projection lookback, simulation count, and optional fixed percentage target and stop boundaries. Output metrics and distribution evaluations are presented via an on-chart statistical display table.
Monte Carlo future path simulation
Historical expected value calculation
Configurable take profit and stop loss percentages
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Max Trade Duration (bars)
int
252
i_trade_duration
Position Size ($)
float
1000.0
i_position_size
Projection Lookback (bars)
int
252
i_momentum_lookback
Historical Lookback (bars)
int
2500
i_lookback_bars
Monte Carlo Simulations
int
1000
i_monte_carlo_sims
Annual Risk-Free Rate (%)
float
5.0
i_risk_free_rate
Use TP/SL for Historical EV
bool
false
i_use_tp_sl
Take Profit (%)
float
10.0
i_tp_pct
Stop Loss (%)
float
5.0
i_sl_pct
Table Font Size
string
Normal
i_font_size_option
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This overlay indicator plots a Supertrend from an ATR length and factor, four exponential moving averages, and a selectable VWAP or TWAP taken from a chosen timeframe on the price chart. It also shows MACD and stochastic with adjustable lengths, smoothing, ver
This multi-symbol indicator evaluates a combined trading condition across up to 40 user-defined symbols. It processes MACD bullish crossovers, RSI thresholds, Bollinger Band boundaries, and DMI/ADX trend filters using security calls. When buy or sell criteria
This indicator calculates theoretical options contract values and in-the-money probabilities using historical realized volatility across multiple standard deviations. It displays these metrics in a table overlay directly on the price chart. Users can adjust th
This indicator maps market structure and supply and demand zones on the price chart. It marks validated and optional unvalidated swing highs and lows using a pivot length and extra confirmation bars. Consolidation and impulse moves are measured against ATR to
Storm Gauge calculates annualized realized volatility and compares it against a historical percentile lookback window to classify market volatility regimes into calm, normal, or storm conditions. Based on a target volatility input, it calculates dynamic positi
The 8zz Contrarian Indicator plots reverse sentiment trading signals directly on the price chart based on tracked retail post activity. It generates bullish signals during retail panic and bearish signals during market euphoria. The indicator features adjustab