panpanXBT

Backtest Engine

panpanXBT Uppdaterad   
This is a simple backtest engine for your trading strategies. The idea behind this script is to make testing new strategies as easy as possible. Parameters such as take profit/stop loss and time period are built into the script and are customisable by the user via the settings interface. The only coding is to set the entry and exit conditions. Users need not touch any code beyond line 30.

For this post, I have used a 50/200 SMA crossover to demonstrate the ease of use for this script.

The features of this script include:
  • Backtest period start
  • Number of days until backtest period end
  • Take profit and stop loss % (via settings)
  • Programmable long and short entry/exit
  • Anti duplicate system (for entry conditions that are continuously satisfied, the engine will only make 1 trade until the is exit condition is satisfied).

DISCLAIMER: The strategy in this post is only a placeholder. The TP/SL levels are set to showcase the functionality of the engine and are in no means optimal settings.

Hope this helps! Feel free to ask any questions about the engine and happy coding!
Versionsinformation:
  • Updated to Pine v5
  • Cleaned up code
Versionsinformation:
  • Added functionality to toggle on/off long and short orders

Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?