Pinescript and Backtrader, both are
used for backtesting of trading strategies on historical data. Pinescript is a
script developed by tradingview platform. Pinescript can be used on
tradingview platform for backtesting. While on the other hand "backtrader" is a python module
developed by python community and is available for free on git hub for download. You can freely
download the backtrader module and can use it with python for backtesting of trading
strategies and development of technical indicators.
Trading community in search of best
backtesting software have often asked this question “pinescript or backtrader”.
Both of them come with some advantage and some drawbacks.
Pros for pinescript and crons for backtrader
Easy to learn and implement : No need to learn an entire programming lanaguage. Pinescript have simple, less coding rules and can therefore easy to learn and implement.
Lots of scripts available in the community library : The tradingview platform encourage users to put their scripts on community library for free download by other users. You can therefore have huge collections of scripts to refer from.
Attractive, user-friendly charting software : The tradingview chart is an intractive chart. You can draw trendlines and mark candles or bars on the chart. At the same time, you can also use pinescript code to mark or highlight bars/candles by use of code.
No need for a separate data source : Tradingview supports almost all the modern exchanges, commodities, forex and thus their is no need for separate datasource for backtesting. You can use data provided by tradingview directly with pinescript.
Crons for pinescript and pros for python
Cannot be used for complex algorithms : As explained earlier, the coding rules are simple and easy to understand, however, if you have a complex strategy, you will find it difficult or impossible to implement the same on pinescript.
Cannot be used for Machine Learning, Deep learning , artificial integillence : Pinescript have no support for ML, deep learning or AI. However, in case you are using backtrader, you can use AI, ML modules of python for implementation in backtrader.
Slow in processing and calculation : Tradingview is a browser based trading / backtesting platform, the real execution takes place at the shared server therefore the execution of pinescript is slower compared to backtrader or other similar python based programme.
The choice of using pinescript or python or backtrader will depend upon the requirement of user, his coding skills. If you are new to the coding and have a simple strategy to implement. You can safely use pinescript, its inbuilt functions. You can learn pinescript from various free sources on internet or you can buy book TradingView Pine Script Programming From Scratch available on amazon or you can also take buy Udemy course Creating trade strategies and backtesting using pinescript. Both the book and udemy course have been created for non-programmers cum traders willing to learn and leverage with coding skills.
If you have complicated trading strategy or want to implement AI, ML , you should learn backtrader. If you are new to python or programming , the suggested book is Teach
yourself python backtrader.