1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
276 lines of Pine Script v5 from strategy-backtesting-template-external.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Backtester For Anything accepts external signals to trigger long or short entries and exits, with optional filters based on EMA and ADX indicators to refine conditions. Time-based restrictions limit trading to specified start and end periods. A dashboard displays key metrics, and configurable take profit and stop loss levels manage position management. It supports percentage-based position sizing and runs on the price chart with a fixed maximum bar lookback.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
External Signal
source
close
external
Enable EMA Filter
bool
false
i_emaFilterEnabled
EMA Length
int
200
i_emaLength
Enable ADX Filter
bool
false
i_adxFilterEnabled
ADX Variant
string
ORIGINAL
i_adxVariant
ADX Smoothing
int
14
i_adxSmoothing
DI Length
int
14
i_adxDILength
ADX Threshold
float
25
i_adxLowerThreshold
Start
bool
true
useStartPeriodTime
startPeriodTime
time
timestamp('1 Jan 2019')
startPeriodTime
End
bool
true
useEndPeriodTime
endPeriodTime
time
timestamp('31 Dec 2030')
endPeriodTime
Show all 21 settings
Setting
Type
Default
Variable
Trade Direction
string
Long and Short
tradeDirection
Require bar close to take profits
bool
false
confirm_tp
Take Profit 1 - Target %
float
2
tp1
% Of Position
int
100
q1
Require bar close for stop loss
bool
false
confirm_sl
Stop Loss (%)
float
1
stoplossPercent
Leverage
float
1
leverage
Alert Syntax Prefix
string
CRYPTANEX_99FTX_Strategy-Name-Here
alertSyntaxPrefix
Show Dashboard
bool
true
showDashboard
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 strategy automates the TradingLatino methodology by evaluating Squeeze Momentum combined with the Average Directional Index (ADX). It executes long or short positions based on momentum shifts and directional strength. Risk management options include const
This long-only trend-following strategy combines Ichimoku Kinko Hyo components with higher timeframe moving average filters. It triggers long entries when price trades above a higher timeframe EMA and a bullish Tenkan-Sen cross above Kijun-Sen occurs under fav
Momentum Rotation (Top 3) ranks ten large-cap US tech stocks by their six-month returns using daily closes. It rebalances monthly and holds the top three performing stocks long only on the price chart. A ranking table shows the current order. Main settings adj
This strategy calculates trend direction across three user-defined higher timeframes using dual Simple Moving Averages, filtered by On-Balance Volume and Commodity Channel Index conditions alongside fractal pivot swings. Entries trigger when multi-timeframe tr
This trading strategy combines Stochastic, RSI, ATR, and multiple Exponential Moving Averages (20, 50, and 200) alongside Fibonacci zones to generate trading signals for gold (XAUUSD). It supports flexible execution modes including scalp and confirm entries, c
This strategy automatically adapts its moving average lengths and types based on the chart's timeframe, covering scalping, intraday, and swing styles. It generates entry signals when a fast moving average crosses a slow moving average, provided price is on the