What are strategies, backtesting and forward testing?

Strategies are specific scripts, written in Pine Script language, which are able to send, modify, execute, and cancel buy or sell orders and simulate real trading right on your chart.

Backtesting is the process of recreating the work of your strategies on historical data, essentially all of your past strategic work. Forward testing allows for the recreation of your strategy work in real-time, all while your charts refresh their data.

How can I get started?

Any user can create a strategy if they know the Pine Script language. The main differences between a strategy and a simple script are the use of the strategy function instead of study and special commands that start with the word ‘strategy’, such as strategy.entry or strategy.exit. Pine Script documentation has a special section dedicated to writing and working with strategies.

You can use pre-made strategies from a list of built-in indicators or from our Community Scripts, which users are welcome to add to.

How can I analyze strategy results?

When you add a strategy to the chart, additional information will appear in the Strategy Tester tab and can show you a report of your strategies results.

There are three sections available: Overview, Performance Summary and List of Trades. You can learn more about the indicators available in each section via our Help Center.

Executed orders are displayed directly on your chart with arrows, varying in color, depending on the operation.

As data is updated on the chart, the report will also be updated. This is forward testing.

Each strategy has parameters, which affect the calculation and result. You can change the parameters in your settings, causing backtesting and forward testing results to change as well.

Strategies can be published just like any script written in Pine. In this case, a report with all indicators will be included in the publication.

What do I do if I still have questions?

If you cannot find what you are interested in within our reference materials, you can ask questions in the Tradingview chat where Pine Script is specifically discussed, or on the StackOverflow website, where we have a separate tag listed.