I would like to normalize the price of the following as an expanding window taking into account all information up to time t (but not after t, to avoid look-ahead bias). So far, I have the code that takes into account the entire dataset, and hence, induces a look-ahead bias. Can someone help me edit the code? Thanks
Code:
clear local ticker "BTC-USD" getsymbols `ticker', fm(1) fd(1) fy(2012) lm(12) frequency(d) price(adjclose) yahoo clear keep period p_adjclose_BTC_USD * Normalization: local To_Norm p_adjclose_BTC_USD foreach var in `To_Norm' { sum `var', meanonly gen n_`var' = (`var' - r(min)) / (r(max) - r(min)) }
0 Response to Normalize variable as an expanding window
Post a Comment