Hi, I think there is a small mistake in the notebook Strategy Analytics.ipynb
where it says:
test_dataset.loc[(test_dataset['High'] > test_dataset['P_H']) & (
test_dataset['Low'] > test_dataset['P_L']), 'Signal'] = -1
I think it should be:
test_dataset.loc[(test_dataset['High'].shift(1) > test_dataset['P_H']) & (
test_dataset['Low'].shift(1) > test_dataset['P_L']), 'Signal'] = -1
because it is the High and Low values of the previous day that have to be compared.
on the other hand, where it says:
Compute GLD returns
test_dataset['gld_returns'] = test_dataset['Close'].pct_change()
I think it should be:
Compute GLD returns
test_dataset['gld_returns'] = (test_dataset['Close']-test_dataset["Open"])/test_dataset["Open"]
because the input parameters:
gold_prices['OD'] = gold_prices['Open']-gold_prices['Open'].shift(1)
gold_prices['OL'] = gold_prices['Open']-gold_prices['Close'].shift(1)
they need to know the Open of the current bar, so the value of the return must be the difference between the closing price and of the open of the same bar, i think.
Cheers,
Enrique Abad