0
$\begingroup$

Sorry for the basic question, I'm trying to educate myself on algorithmic strategies.

Just to see how it works, my idea is to create a simple moving average strategy.

Let us suppose I have $N$ observations of the price of an asset $P_t$

I define the simple moving average of $P_t$ at time $t$

$$\text{SMA}_t^{(n)} = {1\over n}\sum_{k=t-n+1}^t P_k~,$$ where $n$ is the number of prices included in the average.

Now the trading signals are generated by these two trading rules:

  • $\text{BUY}_t$ when $P_t < \text{SMA}_t^{(n)}$
  • $\text{SELL}_t$ when $P_t > \text{SMA}_t^{(n)}$

Every time I have a signal I buy/sell everything I can/have, in other words I maximize the volume of my operations.

My question is how to test this strategy? I tried with the $SP500$ index and I found very good results in terms of $\%$ returns, but I think my approach is misleading since I should compare it with a buy and hold strategy, considered that this index has only grown in the period that I considered...I also read that simple moving average is good when the market is mean-reverting, and this makes sense to me... What are more appropriate way to test it with real-world data? Also, can you suggest the next steps to make it more realistic?

Thanks in advance

$\endgroup$

1 Answer 1

4
$\begingroup$

"What are more appropriate way to test it with real-world data? Also, can you suggest the next steps to make it more realistic?"

Pick a tradable instrument (e.g. SPY rather than S&P500), eliminate look-ahead bias (e.g. trade at the next day's open rather than the close), take into account transaction costs and financing costs, estimate market impact/slippage...I'd guess there are some blog posts and books aimed at retail traders that cover these basic ideas, e.g. from Rob Carver [EDIT: I think Ernie Chan's books might also be of use/interest to you. I have no affiliation with either Carver or Chan]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.