Stock Trading - How to calculate entry/exits when a stock crosses over a moving average?
I have hit a brick wall on my excel knowledge, please help.
I am trying to build a tool in excel where I can load historical stock price data. I want to be able to create a simple backtest so that the following rules apply. I will be importing the data via yahoo finances historical price tool.
Basic Trading Rules (based on the book "The Ivy Portfolio")
When price is > 10 period (day,week,month, etc.) moving average = buy (S&P 500, stock, etc.)
When price is < 10 period (day,week,month, etc.) moving average = Sell (sit in cash)
I can create the code to creat the 10 period moving average, but when I try to put it into $$$ and build a historical return column I get into trouble.
The issue is that once a new "buy" signal occurs, I cannot get the data to build on the previous balance.
I am guessing I am not the only one who has ever tried this... any suggestions?
I am running Excel 2010 on a PC
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Search Engine Friendly URLs by vBSEO 3.6.0 RC 1