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
  • 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.
backtestbacktesterbacktestingstoplossstudyanalysistrailingstopTrend Analysis

סקריפט מוגן

סקריפט זה פורסם במקור סגור ותוכל להשתמש בו באופן חופשי. אתה יכול להגדירו כמועדף כדי להשתמש בו בגרף. אינך יכול להציג או לשנות את קוד המקור שלו.

רוצה להשתמש בסקריפ זה בגרף?


For script access or PineScript questions, please visit our site:
marketscripters.com?utm_source=tradingview&utm_medium=signature
גם על:

כתב ויתור