Course Name: Unsupervised Learning in Trading, Section No: 11, Unit No: 3, Unit type: Notebook
Hi,
I have a question about how the strategy return is computed in the codebook. The return is defined as close.pct_change() * direction_skewness, but the two factors seem to be on different time horizons:
-
The Apple price data consists of 15-minute time bars. Early in the codebook,
time_prd = 15andfut_retis computed withpct_change(time_prd), sofut_retis a 15-bar forward return, i.e. 15 × 15 min = 3.75 hours. -
In the skewness function of the data module, the trading signal (
direction_skewness) for each cluster is generated fromfut_ret.skew(), so the signal is based on the distribution of these 3.75-hour returns. -
The strategy return, however, multiplies that signal by
close.pct_change(), which is a single 15-minute return.
So the direction is chosen from the skewness of 3.75-hour forward returns, but the PnL is realised one 15-minute bar at a time. Is this mismatch intended? If so, what is the reasoning — or should the position be held for the full 15 bars after a signal? When I set time_prd = 1 so that both are on the same horizon, the results differ noticeably from those shown in the codebook, so I want to make sure I understand which configuration is intended.
Thanks in advance for any help.