TradingView
zendog123
3 สิงหา 2021 เวลา 13 นาฬิกา 7 นาที

Zendog Backtest-DCA-Bot-3commas 

Cardano / TetherUSBinance

คำอธิบาย

Hi everyone,
This is a strategy that serves as a basic Backtester for 3commas DCA bots.
You can plugin your own studies into the Backtester, play around with their parameters as well with the DCA parameters and see how they can provide best result on historical data.

Features:
- Meaningful statistics that actually group orders under the same deal.
(base order + safety orders are the same deal, but Tradingview Strategy Tester shows them as separate trades)
See how many safety orders were used for each deal.

- Deal start condition: built in RSI-7 or external indicator
(main purpose of this strategy is to connect your own studies, so using external indicator is recommended)

- Base order and safety orders configs similar to 3commas
(order size, percent deviation, safety orders, percent scale and volume scale)

- Support for Long strategy for now (plan to add Short)

เอกสารเผยแพร่

fixed bug about order volume scale wrong calculation

เอกสารเผยแพร่

- Changed BO order from limit to market order (fixed bug when order is never executed because the market moves away from the limit price)
- Add support for Short besides Long
- Add support for Stop Loss
- Add support to Limit Date Range of the backtest
- Add "Required Capital" and updated stats to reflect this amount. This overwrites strategy.initial_capital so you may disregard it
- Statistics about Winning deals, Losing deals (stop loss) and avg profit/loss for each
- Extended statistics about: Covered deviation, Biggest deviation, Biggest drawdown, Days in deal

เอกสารเผยแพร่

- Fixed Buy and hold calculation to use Required capital
- Fixed corner case bug that showed invalid start/end date for Max # days in deal if longest deal is still running
- Added commission and total volume + update some stats
- Added option for how many decimals to format output (default 2, but use 8 for backtesting BTC pairs)

เอกสารเผยแพร่

Improvements to External Indicator source and value comparison

เอกสารเผยแพร่

Update to statistics table layout

เอกสารเผยแพร่

- improved stats for each deal by taking the price for each order
- add labels for each deal that show profit or loss
- add visual options to the strategy

เอกสารเผยแพร่

- Add support for Take Profit Type: "From Base order" (fixed amount based on BO size) and "From Total Volume" (Amount increases as more SO are placed)
- Add a table with DCA Settings for easier overview on the chart (Off by default it needs to be enabled in Settings)
- Add comparison operator on built-in RSI-7 (>= or <=)

เอกสารเผยแพร่

Fixed statistics bug when SO number is 0 (no safety orders)

เอกสารเผยแพร่

fixed Step table bug when safety orders are 0

เอกสารเผยแพร่

There is a version 2 of this script, which is now opensource!
Thank you for your interest, please like and follow that version as this one will not receive updates in the future. Hope you enjoy!
ความคิดเห็น
nrrd4life
Can you add Asap to this backtest...
zendog123
@nrrd4life, I have released a V2 of this backtest which is open source
BlackBirdTrading
Hey brother can I get hands on code for table only not for the script. I want such table in my script please
jvargasy1
@zendog123, thanks for sharing such brilliant work!
Would it be possible to add % profit from total volume? Right now it calculates profit % from las SO, so it shows losses that otherwise would be profitable when you use profit as % of total volume. (including BO and SOs).

Thanks again!
zendog123
@jvargasy1, Hi, thank you for your kind words and interest. I guess you are talking about the list of trades from Strategy backtester?
jvargasy1
zendog123
@jvargasy1, The way this strategy backtester is supposed to be used is to ignore the stats in Strategy Backtester completely. Unfortunately for the time being pine script does not support grouping multiple orders into the same trade for proper statistics, as I hit that limitation, it was the main reason I took development of this strategy one step further and actually group them. So the number of deals from the Statistics table is different than number of trades from Strategy Tester panel, same for winning deals, losing deals etc (because , for example, if you are not using Stop loss cannot be any losing deals, only "blocked deals still running"). I cannot develop a table with the list of trades, because of Tradingview UI limitations, so that is pretty hard to develop ... I can put labels (can be up to 500) or plotchar on the chart directly for each of the deals, but that requires scrolling back and it is not UI friendly either.
zendog123
@jvargasy1, I forgot to mention that the sum of all profits should be the same in Strategy tester Panel as well, only the list of trades from the table is wrong plus some of the numbers from the Performance Summary, the winning / losing deals, max drawdown, max contract held etc
PrinceRawat
Hello sir.. Can you able to share... How to count closed so1 and %... Thanks very much..
zendog123
Hi @PrinceRawat, The Backtester is already counting how each Deal was finished (SO number or stop loss) them and you can see the stats in the bottom part of the table
เพิ่มเติม