I often try and test strategies in Excel, using data off finance.yahoo.com. A couple things I'm trying to do, but I really need to simplify:
Let's say I want to have a buy signal if a stock has increased by more than [X%] in the last [Y] days. I can do that, but the only way I know how is to in the spreadsheet for each day to compare that day's price to the price [Y] days earlier in the column. That works, but if I start with a 30 day period, I cannot easily switch it to a 60 or 90 day period for example, I have to go into the spreadsheet and change it manually so each day it compares prices to the day 60 or 90 days previously. Its not that hard, but it does take time. What I want to be able to do is just have one cell that I have the lookback period, and I could just type "60" or "90" over the "30" I have in that cell and it would automatically adjust it in the rest of the spreadsheet.
How could I do something like that?
In other words, what I am trying to do is effectively say, in each "test" cell to see whether the increased price is triggered, is say, "compare the price in that cell over there for today with the price in that cell X days ago, where X is obtained from that other cell over there". Then I could just change X and it would all carry over and work out easily. Thus, if we were on row 100, and X is 30, I would want it to back out 30 from that row 100 and look at that cell, but I don't know how to do that.
Kind of a similar question on the flip side:
If the buy is triggered per the above, I want to test holding onto that position for Z number of days, and I want to fill in Z in a cell and it automatically carry through the entire spreadsheet.
Thanks for any help on this!!!
Let's say I want to have a buy signal if a stock has increased by more than [X%] in the last [Y] days. I can do that, but the only way I know how is to in the spreadsheet for each day to compare that day's price to the price [Y] days earlier in the column. That works, but if I start with a 30 day period, I cannot easily switch it to a 60 or 90 day period for example, I have to go into the spreadsheet and change it manually so each day it compares prices to the day 60 or 90 days previously. Its not that hard, but it does take time. What I want to be able to do is just have one cell that I have the lookback period, and I could just type "60" or "90" over the "30" I have in that cell and it would automatically adjust it in the rest of the spreadsheet.
How could I do something like that?
In other words, what I am trying to do is effectively say, in each "test" cell to see whether the increased price is triggered, is say, "compare the price in that cell over there for today with the price in that cell X days ago, where X is obtained from that other cell over there". Then I could just change X and it would all carry over and work out easily. Thus, if we were on row 100, and X is 30, I would want it to back out 30 from that row 100 and look at that cell, but I don't know how to do that.
Kind of a similar question on the flip side:
If the buy is triggered per the above, I want to test holding onto that position for Z number of days, and I want to fill in Z in a cell and it automatically carry through the entire spreadsheet.
Thanks for any help on this!!!
