Filter löschen
Filter löschen

Detrending relative strengh index

5 Ansichten (letzte 30 Tage)
Andriy Artemyev
Andriy Artemyev am 17 Jan. 2020
Kommentiert: Javier Ossa am 19 Apr. 2020
Greetings,
I have a question regarding a technical analysis indicator used for algorithmic trading. My question relates to the following Matlab Demo: https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/29489/versions/3/previews/AlgoTrading2010/html/AlgoTradingDemo2.html
In this Demo the author uses the relative strength index by using the function rsindex(). Normally this index is used on closingprices of an asset. The author however suggests to detrend the closing prices by substracting a moving average and calculating the relative strengh index on this detrended time series. This should improve the quality of signals generated from this indicator. His exact line of code is:
rsindex(BundClose-movavg(BundClose,30,30),14); where BundClose is a timeseries of closing prices.
However, when I run this line of code on my own price data, I get this error message:
"Expected Closing Price to be nonnegative."
This makes sense, as the price will sometimes be below it's moving average. So I'm wondering why it worked in the demo mentioned and how best to go about calculating such a bounded indicator on detrended price series.
Thanks in advance!
  3 Kommentare
Javier Ossa
Javier Ossa am 19 Apr. 2020
this why is negative and Zero
%rs2 = rsindex(BundClose-movavg(BundClose,30,30),14);
BundClose
BundClose = 11339×1
106.61
106.57
106.53
106.48
106.47
106.42
106.5
106.47
106.47
106.47
movavg(BundClose,'exponential',30)
ans = 11339×1
106.61
106.607419354839
106.602424557752
106.594526199188
106.586492250853
106.575750815314
106.570863665939
106.564356332653
106.55826882732
106.552574064267
BundClose-movavg(BundClose,'exponential',30)
ans = 11339×1
0
-0.0374193548387183
-0.0724245577523561
-0.114526199187694
-0.116492250853014
-0.155750815314107
-0.0708636659390152
-0.0943563326526373
-0.0882688273202206
-0.0825740642673196
rs2 = rsindex((BundClose-movavg(BundClose,'exponential',30)),'WindowSize',14)
should i use absolut values from the ma?
Javier Ossa
Javier Ossa am 19 Apr. 2020
I need to check the math formula from RSI

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Transaction Cost Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by