allanster

How To Auto Set Date Range

allanster Wizard Cập nhật   
Example how to automatically set the date range window to be backtested from X days or weeks ago to present. Additional options are also included to manually set the date range or to show entire range available.

Normally when you change chart period it changes the number of days being backtested, which means as you increase the chart period (for example from 5min to 15min), you also increase the number of days traded. So you can not compare apples to apples for which period would yield best performance for your strategy.

By incorporating this code with your own strategy's logic (replacing buy and sell), it will allow you to compare results of different period backtests over the same duration of time.

Date Range: ALL uses entire history.
Date Range: DAYS uses number you set in # Days or Weeks
Date Range: WEEKS uses number you set in # Days or Weeks
Date Range: MANUAL uses manual dates you set in From and To fields

Much gratitude to @pinechrix for suggesting this improvement to me, and to @Gesundheit for pointing me in the right direction on the original example I published previously. Thank you both!

NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
Phát hành các Ghi chú:
Added option to show on chart the date range selected.
Phát hành các Ghi chú:
Consolidated inputs for day, month, year.
Phát hành các Ghi chú:
Updated for Pine Script v5.

Telegram: t.me/allanster • Website: www.allanster.com

If you wish to buy me a refreshing beverage :)...

LTC (preferred): LTDaAe7nPzbpBhZVT9o5f9f8M3aZSPa46Y

BTC: 13LhkeXBYrRomVAqbXcoLXHuqMk6Mf7G6N
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?