====== Data Horizon ======
Data Horizon controls which part of the loaded market data is used for Generator calculations.
Use this section to:
* limit the history window by dates
* limit bars count
* define when trading starts inside the selected window
This is one of the key sections for building an in-sample and out-of-sample workflow.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Data Horizon ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
max_data_bars = 100000
; Use these parameters to set the data range between "data_start" and "data_end".
; Set from where the actual trading starts with "trade_start".
; Text: "2023-05-25 00:00 UTC", "2023-05-25 00:00", "2023-05-25" or "25 May 2023 00:00 UTC"
; Negative number: number of days before the current date: -365, -30, -7
use_data_start = false
data_start = "01 Jan 2020 00:00 UTC"
use_data_end = false
data_end = "30 Jun 2023 00:00 UTC"
use_trade_start = false
trade_start = "01 Jun 2023 00:00 UTC"
===== What each option does =====
* ''max_data_bars'' limits the maximum number of bars loaded after date filters are applied.
* ''use_data_start'' + ''data_start'' cut bars before the start date.
* ''use_data_end'' + ''data_end'' cut bars after the end date.
* ''use_trade_start'' + ''trade_start'' keep data for indicators, but start opening trades later.
===== How ''data_end'' limits data =====
When ''use_data_end = true'', Generator stops the dataset at ''data_end''.
Bars after that timestamp are excluded from calculations in that run.
Practical effect:
* your strategies are generated or validated only on the capped history window
* newer bars are not seen in that run
===== OOS workflow with recalculation on full data =====
You can use ''data_end'' to create a clear split between historical training data and newer unseen data.
Typical 2-step process:
* Step 1 (in-sample build): run Generator with ''use_data_end = true'' to cap history at an older date.
* Step 2 (recalculation/validation): run Generator again on the full dataset (for example ''use_data_end = false'').
In Step 2, the bars that were excluded by Step 1 become your practical out-of-sample segment.
This lets you check how strategies behave on data that was not included during the capped run.
===== Example profile =====
Build collection only up to 30 Jun 2023:
use_data_end = true
data_end = "30 Jun 2023 00:00 UTC"
Then validate the same collection on full history:
use_data_end = false
===== Notes =====
* Data Horizon is applied before Out of Sample percentage filters.
* For additional control of unseen-data validation, see [[forward-testing|Forward testing]].
* Percent-based splitting is documented in [[out-of-sample|Out of sample]].
===== Related pages =====
* [[forward-testing|Forward Testing]]
* [[out-of-sample|Out of sample]]