PROTECTED SOURCE SCRIPT
Study Backtester [MS]

Backtest your study like a strategy with our Study Backtester. Visualize your script's performance directly on the chart.
Simple to use, copy-paste a few lines of code (shown below) into your script, then set your script as input to the Study Backtester.
Visualize how your script performs against buy-and-hold over time, and get a nice print out of stats.
Settings
Version 1
Things To Note
How To Use
1) Add the following to the bottom your study's code.
//------------------------------------------------------------------------------
// FOR BACKTESTER
plot(buy ? 1 : sell ? -1 : na, title="Signals", display=display.none, editable=false)
2) Make sure `buy` and `sell` variables are assigned appropriately according to your strategy.
3) Add both your study and this script to your chart.
4) Set the "Signals Plot" setting of this script to: <your_study_name>: Signals
5) Adjust this script's settings (start date, commission, stoploss, etc) as necessary.
PM us with any questions about this script.
Simple to use, copy-paste a few lines of code (shown below) into your script, then set your script as input to the Study Backtester.
Visualize how your script performs against buy-and-hold over time, and get a nice print out of stats.
Settings
- Set your buy and sell signal inputs
- Add a stop loss
- Choose normal or trailing stop loss
- Choose the start date and time for backtesting
- Set trading commissions
- Use leverage or not
- Set carry cost for leveraged trades
Version 1
- Only supports buy-sell-buy-sell alternating signals. Any non-alternating signals will be ignored.
- Testing begins with 1 share of the asset at your first buy signal.
Things To Note
- This cannot enter or exit mid-candle. With the exception of the stop loss feature, which will calculate exits at the exact stop price.
- Stops are not treated as stop-orders, but as market-exists at the stop (or trailing stop) price.
- This DOES NOT take into account any loss of funds due to liquidation if price goes against you in a margin position.
- Short positions are not currently supported.
- Only `study` scripts are supported
How To Use
1) Add the following to the bottom your study's code.
//------------------------------------------------------------------------------
// FOR BACKTESTER
plot(buy ? 1 : sell ? -1 : na, title="Signals", display=display.none, editable=false)
2) Make sure `buy` and `sell` variables are assigned appropriately according to your strategy.
3) Add both your study and this script to your chart.
4) Set the "Signals Plot" setting of this script to: <your_study_name>: Signals
5) Adjust this script's settings (start date, commission, stoploss, etc) as necessary.
PM us with any questions about this script.
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
For script access or PineScript questions, please visit our site:
marketscripters.com?utm_source=tradingview&utm_medium=signature
marketscripters.com?utm_source=tradingview&utm_medium=signature
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
For script access or PineScript questions, please visit our site:
marketscripters.com?utm_source=tradingview&utm_medium=signature
marketscripters.com?utm_source=tradingview&utm_medium=signature
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。