marketscripters

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
  • 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:
www.marketscripters.com?utm_source=tradingview&utm_medium=signature
보호된 스크립트입니다
이 스크립트는 클로즈 소스로 게시되며 자유롭게 사용할 수 있습니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다. 소스 코드는 보거나 수정할 수 없습니다.
면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?