View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Help with this Formlua

Now that's a better explanation!

Enter this array formula in say H2

=IF(F2<"","",IF(OR(AND(INDEX($F$1:$F$1000,J2)="BU Y",INDEX($E$1:$E$1000,J2)-
5E2),AND(INDEX($F$1:$F$1000,J2)="SELL",INDEX($E$1 :$E$1000,J2)+5<E2)),"STOP"
,""))

as an array formula, commit it with Ctrl-Shift-Enter, then copy down

Hope we have got it now!

--

HTH

RP
(remove nothere from the email address if mailing direct)


"zmr325" wrote in message
...
I need some assistance with this one: In my sheet below I have certain

buy
and sell signals for this commodity. I used an =if(and()) statement with
about 4 logical steps to come up with these buy and sell points. You

can't
see the formula because I have taken it out. But my next step which I

don't
understand is how to write a formula to get me out if the price goes

against
me. So lets take 7/19/2005 BUY signal for an example. I need to find a

way
to have the formula read that when I get a BUY signal take the close price
that period and minus say 5 from that. Now if the low from the next

period
or however many of periods it is until you get a sell signal goes below

that
number it should read "STOP" and you exit the position. The same would be
for the SELL signal but instead of minus you would add it to the close

price
and see if the HIGH periods go through that number. My problem is is

there
is a way to keep a running column with each new period changing to let you
know if those parameters have been hit or not. I will be happy to answer

any
questions if this is not clear. I thought about =if then statements= but
not sure on how to write all of this. Thank you again.
NOel
Date-SPH Open High Low Close BUY SELL
7/1/2005 1,204.50 1,207.50 1,202.50 1,206.00
7/5/2005 1,202.00 1,216.50 1,202.00 1,215.10
7/6/2005 1,215.00 1,216.10 1,204.00 1,204.70
7/7/2005 1,191.70 1,208.80 1,191.70 1,208.80
7/8/2005 1,215.00 1,223.50 1,207.50 1,222.50
7/11/2005 1,225.00 1,230.50 1,224.00 1,229.60
7/12/2005 1,229.50 1,235.00 1,227.00 1,231.80
7/13/2005 1,230.40 1,234.50 1,230.30 1,234.30
7/14/2005 1,243.00 1,243.30 1,234.30 1,238.10
7/15/2005 1,234.50 1,239.50 1,234.00 1,237.60
7/18/2005 1,235.00 1,235.00 1,230.50 1,232.80
7/19/2005 1,237.00 1,240.00 1,234.00 1,239.60 BUY
7/20/2005 1,235.70 1,247.00 1,232.70 1,242.90
7/21/2005 1,244.00 1,244.00 1,234.50 1,236.40
7/22/2005 1,239.00 1,244.00 1,235.50 1,243.40
7/25/2005 1,243.20 1,247.50 1,236.50 1,240.50
7/26/2005 1,239.50 1,243.00 1,239.00 1,241.40
7/27/2005 1,239.90 1,246.50 1,238.80 1,246.30
7/28/2005 1,249.70 1,254.00 1,245.00 1,253.60
7/29/2005 1,253.50 1,254.00 1,243.40 1,243.40 SELL
8/1/2005 1,246.50 1,248.00 1,243.50 1,244.20
8/2/2005 1,248.00 1,253.50 1,248.00 1,251.80
8/3/2005 1,250.00 1,254.50 1,250.00 1,254.50
8/4/2005 1,250.00 1,250.00 1,243.50 1,244.60 SELL
8/5/2005 1,241.00 1,242.00 1,233.60 1,236.40
8/8/2005 1,238.50 1,241.00 1,231.50 1,233.90
8/9/2005 1,239.50 1,242.50 1,236.00 1,241.00 BUY
8/10/2005 1,246.80 1,250.50 1,235.50 1,240.50 SELL
8/11/2005 1,239.00 1,246.50 1,237.20 1,245.20
8/12/2005 1,242.00 1,243.50 1,235.00 1,237.70
8/15/2005 1,238.80 1,244.70 1,235.20 1,244.20 BUY
8/16/2005 1,239.30 1,240.20 1,227.00 1,228.10 SELL
8/17/2005 1,227.30 1,233.60 1,226.50 1,228.10
8/18/2005 1,225.00 1,231.50 1,225.00 1,227.60
8/19/2005 1,232.30 1,233.50 1,228.20 1,230.40
8/22/2005 1,230.80 1,237.00 1,225.00 1,230.70
8/23/2005 1,228.60 1,231.00 1,222.50 1,228.00
8/24/2005 1,223.30 1,232.00 1,216.00 1,216.40
8/25/2005 1,218.60 1,221.00 1,217.10 1,220.20
8/26/2005 1,219.30 1,219.30 1,212.00 1,212.40
8/29/2005 1,208.50 1,222.20 1,208.50 1,221.00 BUY
8/30/2005 1,216.60 1,216.60 1,208.50 1,215.00
8/31/2005 1,217.00 1,230.30 1,211.50 1,227.80
9/1/2005 1,228.20 1,234.50 1,223.80 1,227.90
9/2/2005 1,231.90 1,232.00 1,224.00 1,225.90
9/6/2005 1,230.00 1,241.00 1,230.00 1,240.50
9/7/2005 1,239.50 1,244.00 1,238.00 1,241.90
9/8/2005 1,239.50 1,242.70 1,236.00 1,238.20 SELL
9/9/2005 1,238.00 1,250.30 1,237.20 1,248.50 BUY
9/12/2005 1,249.00 1,250.90 1,245.50 1,246.60 SELL
9/13/2005 1,246.10 1,246.60 1,237.70 1,238.90
9/14/2005 1,238.80 1,242.00 1,232.20 1,234.60
9/15/2005 1,234.50 1,238.50 1,230.70 1,233.50
9/16/2005 1,233.50 1,244.70 1,232.80 1,242.30 BUY
9/19/2005 1,242.60 1,242.70 1,233.50 1,238.00 SELL
9/20/2005 1,237.80 1,242.80 1,225.60 1,227.60
9/21/2005 1,227.40 1,229.30 1,214.50 1,215.90
9/22/2005 1,215.90 1,222.70 1,211.00 1,219.80 BUY
9/23/2005 1,219.60 1,224.80 1,215.10 1,220.50
9/26/2005 1,224.20 1,229.00 1,217.00 1,221.50
9/27/2005 1,221.50 1,226.00 1,216.20 1,221.70
9/28/2005 1,221.60 1,226.70 1,217.70 1,222.80
9/29/2005 1,222.40 1,234.30 1,216.30 1,231.80
9/30/2005 1,231.60 1,235.80 1,230.00 1,234.30
10/3/2005 1,235.30 1,238.80 1,229.90 1,231.80 SELL
10/4/2005 1,231.50 1,235.50 1,216.60 1,216.80
10/5/2005 1,216.80 1,218.30 1,200.20 1,200.70
10/6/2005 1,200.80 1,206.90 1,186.00 1,196.90
10/7/2005 1,197.00 1,204.50 1,195.20 1,200.00 BUY
10/10/200 1,199.70 1,204.30 1,189.60 1,190.00
10/11/200 1,190.00 1,198.00 1,187.30 1,188.40
10/12/200 1,189.20 1,194.70 1,177.60 1,178.50
10/13/200 1,179.00 1,184.30 1,172.00 1,178.10
10/14/200 1,178.50 1,191.50 1,178.40 1,189.90 BUY
10/17/200 1,189.80 1,195.50 1,186.50 1,194.20
10/18/200 1,193.90 1,196.70 1,181.00 1,181.40 SELL
10/19/200 1,182.00 1,200.80 1,174.00 1,200.40
10/20/200 1,199.10 1,200.80 1,175.70 1,179.50
10/21/200 1,179.80 1,190.00 1,175.90 1,183.80
10/24/200 1,183.80 1,203.30 1,183.30 1,202.40
10/25/200 1,202.00 1,204.70 1,192.00 1,198.90 SELL
10/26/200 1,198.80 1,207.00 1,193.90 1,196.00
10/27/200 1,195.40 1,196.10 1,181.00 1,182.50
10/28/200 1,181.30 1,201.20 1,179.50 1,199.70 BUY
10/31/200 1,199.80 1,214.50 1,199.70 1,209.80
11/1/2005 1,203.90 1,210.50 1,203.00 1,206.30
11/2/2005 1,206.10 1,218.50 1,202.50 1,218.10
11/3/2005 1,218.00 1,227.70 1,216.00 1,223.70
11/4/2005 1,223.50 1,225.70 1,216.70 1,222.00 SELL
11/7/2005 1,222.40 1,227.00 1,219.50 1,222.80
11/8/2005 1,222.70 1,224.30 1,218.50 1,222.80
11/9/2005 1,222.50 1,229.50 1,218.80 1,223.70
11/10/200 1,223.50 1,235.30 1,217.50 1,233.70
11/11/200 1,233.70 1,238.60 1,232.50 1,238.00
11/14/200 1,238.10 1,240.10 1,234.10 1,237.20 SELL
11/15/200 1,237.20 1,240.80 1,228.60 1,232.50
11/16/200 1,232.30 1,235.00 1,229.50 1,234.70
11/17/200 1,234.40 1,246.00 1,233.80 1,245.20
11/18/200 1,245.00 1,252.20 1,242.50 1,250.20
11/21/200 1,250.20 1,258.30 1,248.60 1,257.00
11/22/200 1,256.80 1,263.90 1,253.10 1,262.10
11/23/200 1,261.50 1,272.70 1,261.00 1,268.60
11/25/200 1,268.30 1,270.60 1,265.90 1,270.10
11/28/200 1,269.70 1,273.10 1,258.80 1,260.90
11/29/200 1,260.80 1,267.80 1,259.00 1,259.30
11/30/200