+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : Holding a Value in Excel

  1. #1
    Registered User
    Join Date
    06-23-2010
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2007
    Posts
    1

    Holding a Value in Excel

    I was hoping to get some help with one of my school projects.


    We are doing a Technical Analysis of a stock (mine is Devon Energy DVN). I took the daily adjusted close of the last three years, and have calculated the 10-Day Moving Average and the 30-Day Moving Average. From there our Recommendation simulator is based the on the following requirements.

    1. For a "Buy" recommendation the 10-Day Moving Average (MA) but be increasing; The 30-day MA must also be increasing; and the 10-Day MA must be greater than the 30-day MA. These are denoted by 1's for true and 0's for false. If all are true (all 1's) then it is a buy recommendation.

    2. For a "Sell" recommendation it is the complete opposite. The 10-day MA must be decreasing; the 30-day MA must be decreasing; and the 30-day MA must be greater than the 10-day MA. The events are also denoted by 1's for true and 0's for false. All of the elements must be there for a "Sell Recommendation"=all 0's.

    3. Once you buy the stock you hold onto it until you have a sell recommendation. Only then can you Sell the stock. After you have sold you can not sell again until you Buy again.

    The problem I am having is that once you buy the stock, the initial adjusted closing price that you bought at must stay the same for the entire column until you hit a sell recommendation. I am having trouble coming up with a nested IF function. This is assuming that a nested IF function is correct (incase anyone else has an idea of how this could be done). However, the function must be able to fill the entire column in one swoop.

    Does anyone know how this is possible to hold a value until this other condition is met?

    I have attached my spread sheet.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    149

    Re: Holding a Value in Excel

    You need another column to indicate whether you're actually holding the stock (see attached, inserted column H). I then modified your Buy/Sell formulas to also look at col H. Then price is a simple IF statement.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    149

    Re: Holding a Value in Excel

    Of course I didn't really pay attention on the Gross Return formula and got the prices backwards... s/b current price minus bought price.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1