# Tag Info

13

You can either reuse the last computed EMA, or fill-forward the previous period's sample data and recompute the EMA. I generally prefer the second option, which should cause a decay. Only go for the first option if your application won't change its logic based on missing data.

12

Seeing a pattern in a chart is the finance equivalence of a Rorschach test---the discerned pattern says more about the person than the image. And really, if you want to trade that way, you may as well use astrology. Your real question seems to be: How can I accept or reject the hypothesis that Bollinger bands are an acceptable trading signal? For that,...

10

These moving strategies are also known as trend-following. If returns have positive autocorrelation, hurst exponent > 0.5 that would be good for these strategies.

5

Just like everyone else that's been down this path, you'll have to prove this stuff to yourself. Make sure that one of your competing tests is a "noise test" where the decision to go long or short is driven by a meaningless random number generator. If your method can't statistically outperform noise, then your method is not doing anything meaningful.

4

Note: Assuming you're a bit of a beginner trying to learn the ropes of how this whole process works at a high level, I can definitely make a couple recommendations (if I'm interpreting that wrong then I apologize if the explanation below isn't what you're after). If you're trying to learn some basic backtesting fundamentals, while QuantStart is an amazing ...

3

My understanding, in that context, is that signal indicates that you want to hold a share (signal is 1) or hold no shares (signal is zero). Therefore taking the diff will tell you if you want to buy (signal zero to 1, diff is 1), sell (signal 1 to zero, diff is -1) or do nothing (signal stays at zero or stays at 1, diff is zero).

3

As can be seen from this example from Yahoo!Finance this should not happen (click on "+ The adjusted close"): https://help.yahoo.com/kb/finance/SLN2311.html?impressions=true Another more complete example can be found here: http://luminouslogic.com/how-to-normalize-historical-data-for-splits-dividends-etc.htm So my explanation is that this is a glitch in ...

3

Trading days.................. Days where there is pricing information. Any moving average is a moving average of pricing information. Not the times where there can be no pricing information.

3

In fact there is an exhaustive paper on this issue available now: "The Trend is not Your Friend! Why Empirical Timing Success is Determined by the Underlying’s Price Characteristics and Market Efficiency is Irrelevant" by Peter Scholz and Ursula Walther, Frankfurt School Working Paper, CPQF No. 29, 2011 Fascinating read - highly recommended!

2

You should look into inhomogeneous time series operators. The original reference for this work is Zumbach and Muller (2001). An excellent introduction to the material can be found in An Introduction to High-Frequency Finance, starting on page 59. I also found online a book chapter from Modeling Financial Time Series with S-PLUS that includes code for the ...

2

Let's approach the answer to your question from a pure trading and risk management perspective because looking at it from a mathematical standpoint nor quant standpoint does not yield you much here: 1) Bollinger bands are nothing else than standard deviation envelopes around the mean of past prices of the underlying. So, as far as simple probabilities go, ...

2

def bbands(price, length=30, numsd=2): """ returns average, upper band, and lower band""" ave = pd.stats.moments.rolling_mean(price,length) sd = pd.stats.moments.rolling_std(price,length) upband = ave + (sd*numsd) dnband = ave - (sd*numsd) return np.round(ave,3), np.round(upband,3), np.round(dnband,3) sp['ave'], sp['upper'], sp['...

2

The TA_lib Technical Analysis library here has open source code for numerous indicators.

2

First of all, I do not believe the "optimal smoothing" of an estimator (like the mean or the variance) and the "regression case" are the same. The smoothing of an existing estimator (like mean or variance in the blog post), is an univariate problem, where the regression is a multivariate one. In the regression case, you should be able to change the ...

2

Did you try solving for $w_k$? $$\bar{r}_t = \sum_{k=0}^p w_k r_{t-k}$$ $$\bar R = W R$$ Since you probably have $t>>k$, you can solve for $W$ using OLS $$\bar R = W R +\varepsilon$$ -- UPDATE You can try applying Kalman filter. Here, your state evolution is $$r_t=\mu+\varepsilon_t$$. You introduce new vector $x_t=(r_t, r_{t-1}, \dots, r_{t-p+1})$...

2

It is unlikely that you could beat the market in the long-term with such a simple strategy. But, since you ask about optimization (not real trading), all you have to do to is run the optimization tests over and over again with different parameters until you find the exact moving average combinations that would predict the past perfectly. The only problem is ...

1

Under weak-form efficient markets neither situation is more profitable to buy in. Contrarily, under technical analysis, the answer depends on whether you adhere to a mean-reverting or a momentum theory of the market. Under the former, your supposition is correct. Under the latter, certain shorter-term MAs crossing certain longer-term MAs from below are ...

1

They are different things, it depends on what you are looking for: Bollinger bands are constructed based on the standard deviation of closing prices over the last n periods. An analyst can draw high and low bands a chosen number of standard deviations (typically two) above and below the n-period moving average. The bands move away from one another when ...

1

got my answer myself, and the answer is: That depends, but people mostly use close price. http://www.macroption.com/calculating-moving-average-prices/

1

Thanks @Aksakal for suggesting Kalman Filter. Here I provide more details. We will view it as a state-space model: $$\begin{split} z_t &= A_t z_{t-1} + B_t u_t + \epsilon_t, \\ y_t &= C_t z_t + D_t u_t + \delta_t, \\ \epsilon_t &\sim \mathcal{N}(0, Q_t),\ \delta_t \sim \mathcal{N}(0, R_t), \end{split}$$ where $z_t$ is the latent variable, $y_t$...

1

The Technical Analysis of Financial markets is considered as a milestone of the matter. I suggest to read that before starting to test your strategy. It explains well the use of each indicator, providing the economic reason behind that and when it is useful to use that; moreover, the book deals the stock market with mainly, as you need for. In my humble ...

1

A very good reference can be found here: http://www.asiapacfinance.com/trading-strategies/technicalindicators

1

I think wiki calculated upon new way and your excel calculated upon Wilder way (Wilder book). I have same issue when use both method. Look like new Metastock 5 software offer both method.

1

Try to plot the rolling mean against your quotes for SP and see if it makes sense. Although you line of code to compute the rolling mean is correct, there might be something wrong in the data that you pass as input.

1

Two good starting points are here: Allen, Helen, and Mark Taylor. “The Use of Technical Analysis in the Foreign Exchange Market.” The Journal of International Money and Finance, June 1992, pp. 304-314. Lui, Y.H., and D. Mole. “The Use of Fundamental and Technical Analyses by Foreign Exchange Dealers: Hong Kong Evidence.” The Journal of International Money ...

1

A simple solution to what you may be looking for is: Bollinger Bands: It is an a channel with the center being an MA with a roof of being K Stddevs and a floor of -K stdves. See also: http://en.wikipedia.org/wiki/Bollinger_Bands You can use this to see "how far outside of the channel of "reality" does your model go, i.e. by creating a tight band around ...

1

Apparently in Forex markets, technical analysis is becoming less and less effective: http://forextradingtipsdaily.com/fed-paper-power-of-technical-analysis-in-forex-is-declining/ I wonder if this is also the case for equity.

Only top voted, non community-wiki answers of a minimum length are eligible