Excel formulae, conditional outcomes based on othe

2019-07-30 13:33发布

问题:

So the premise of what i am making is fairly simple and possibly the formulas are too but i only know pretty basic stuff, hence turning to you fine people.

So the only real input values on this sheet are in the 'Live Price' column, that is raw data coming in. Pretty much everything else are formulas to get populate the cells.

'Lowest since last signal' is pretty basic, i'm using =IF(A3<B2,A3,B2) but what i actually need is to incorporate another IF function as this should 'reset itself' after each time 'Action to be taken' column generates either a Buy or Sell (but not hold). So it is the lowest value the live price as reach since the last buy or sell action was given.

'Action to be taken' looks like this =IF(E3>0.01,"Buy",IF(E3<-0.01,"Sell","Hold")) but actually i just realised that something else needs to be added, you can't sell something if you have already sold it, so this formula needs to be changed in someway so that 'if the action generated is the same as the action in the cell above then the cell should read 'Hold'.

'% Change' is simply =(A3-B2)/B2

'Running total' i would think is going to be very hard to come up with a formula, so you start with $1000 of stock, you always use 100% of funds to buy and sell. The action to buy or sell is given at +1% or -1% from the lowest or highest point since the last action was issued. Therefore even if the stock price dropped -5% the actual loss is -1% because the action to sell was given earlier. The buy gets triggered at +1% but obviously you keep all the percentage gains until the sell command is triggered so even when holding.

I'm finding this hard to even put down is words so have no idea at all where to start with the formulas, any help you can give is really appreciated.

screen grab I can't upload the data as it keeps saying its code when its not and i have no idea what to highly as code??

Live       Lowest     Highest    Action       % Change  Running     Running
Price      since      last       since last   to be     total in    total in
           signal     signal     taken        stock ($)
$126.63    $126.63    $126.63    n/a               n/a     $1,000.00    $0.00
$122.85    $122.85    $126.63    Sell         -2.99%        
$125.38    $122.85    $126.63    Buy           2.06%        
$123.87    $122.85    $126.63    Hold          0.83%        
$125.29    $122.85    $126.63    Buy           1.99%        
$124.83    $122.85    $126.63    Buy           1.61%        
$123.84    $122.85    $126.63    Hold          0.81%        
$127.89    $122.85    $127.89    Buy           4.10%        
$124.08    $122.85    $127.89    Buy           1.00%    

This is a shared link from Microsoft One Drive: https://1drv.ms/x/s!Ao0OmnEKfEp00XRjZd2ChaI2TFtC

Microsoft One Drive