Strategy weekly results as numbers v1

This script is based on an idea of monthly statistics that have been found across tradingview community scripts. This is an improved version with weekly results with the ability to define the size of every group (number of weeks within one group).

Initial setup of the strategy
1. Set the period to calculate the results between.
2. Set the statistic precision and group size.
3. Enable "Recalculate" → "On every tick" under the strategy "Properties" section.

The logic under the hood
1. Get the period between which to calculate the strategy.
2. Calculate the first day of the first week within the period.
3. Calculate the latest day of the latest week within the period.
4. Calculate the results of the selected period.
5. Group the values by the defined number of cells.
6. Calculate the summary of every group.
7. Render the table.

Please, be careful. To use this tool you will need to enable the "Recalculate" → "On every tick" option but it means that your strategy will be executed on every tick instead of bar close. It can cause unexpected results in your strategy behaviour.

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。