Reading what I have, I can only offer a guess.
1: Let's say you're looking at 9 sectors compared to \$SPX on a daily chart. Foreach sector, compute relative closing price: 100 * Sector/\$SPX
2: It looks like the RS-Ratio is averaged over 14 periods. I say 14 because stockcharts.com shows RS-Ratio peaking after a lag (2-3wks), despite price peaking 2-3 ...
Why not just use Geometric Mean Returns? Each time you buy/sell an ETF calculate the holding period return as a percentage and plug into the formula. The answer is a percentage that you can use to calculate the approximate money appreciation (or loss) against your "fixed notional"
I think the normalisation step is incorrect. Since we would like have 100 as our baseline, it should be 100 + ((value-mean)/stddev + 1). Then we get fairly realistic results.
See the following Python function (code review welcome):
def rs_ratio(prices_df, benchmark, window=10):
from numpy import mean, std
for series in prices_df:
rs = (...
The most likely reason I can think of is the ease of computation. Gerald Appel developed the MACD in the late 1970's, when computing resources were very limited. When doing calculations by hand, on paper, it's much easier to take the difference of two simple (or exponential) moving averages than the log of their quotients.
Here are some more :
Ln(Close) - Ln(Close1) : Close1 is previous close.
(Close-LowN)/(HighN-LowN) : LowN and HighN are the low and high within the last N values.
Some more information about the problem would help.
This answer can certainly be improved with more information: like which instruments, what time scale etc.
If you can assume one instrument to be the 'base' instrument then the ratio of the prices is a good measure with both time series beginning at the same time. This is similar to calculating relative return. I have used this when backtesting a pairs ...
You may notice that the difference between the middle bands and upper and lower bands is simply a constant of realized standard deviation of price. If you want to feed a prediction algorithm some standardized data which is comparable for all securities, I would suggest indicators which operate on logarithmic price changes.
Since it is your model you can do anything. What I would do is use some dynamic outlier exclusion. For example in this case you know the min is zero.
One method (of many) might be to evaluate the median (since it might be more robust that the standard deviation or mean) and use 2 x median as your upper limit:
>>> arr = np.array([100,200,19,0,200,...
I've seen that done by using a cash component that changes with your portfolio earnings. You can use that to help you track your dividends as well. If you are using leverage then you can accumulate your carry cost in the cash component as well.
Specifically for using Bollinger bands, you could use the %B indicator. This will scale your price data to the 0 to 1 range ( easily adjusted to -1 to +1 range ) which is convenient for the Sigmoid or Tanh activation functions of a neural net.
You must not use "tomorrow"'s data to normalize "today"'s one. So it is not a good idea to use global min/max, mean/std ... across the whole time series window. The same true is for "cycles" - you can't use data from the end of the cycle to normalize data in the beginning of the cycle.
So, at every time point of your time series you may do any kind of ...
Normalize by assuming both prices at t(1) = 1, and then multiply every t by (1 + price change in %) to get normalized price at t+1. Difference in tick size does not matter it will just make the spread volatility larger. However you will have to account for that tick size when you back test.
Normalized data are not supposed to be in $[-1,1]$, but they're supposed to be "centered" around 0 (because you subtract the mean of the sample) and with values spread from 0 in a way which makes it comparable between different variable size (because you divide by the standard deviation of the sample).
A quick example is let's say you compare two random ...
The point of normalization is to put everything on the same level (i dont mean price level.) Prices are usually nonstationary, so CLT doesnt apply, while returns arent. So @siegel 's answer is correct in saying use a) with return data.