Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Price crossing yesterdays closing price Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
fowlie48
Posted : Wednesday, June 29, 2011 10:44:18 AM
Registered User
Joined: 10/10/2007
Posts: 22
would like a real code for price crossing yesterdays closing price (up or down)

Thanks,
Joe
Michael_T
Posted : Wednesday, June 29, 2011 3:15:42 PM


Worden Trainer

Joined: 10/7/2004
Posts: 710
fowlie48

Try this:
If price.close(1) > price.low And price.last > price.close(1) Or price.close(1) < price.high And price.last < price.close(1) Then pass   
fowlie48
Posted : Wednesday, June 29, 2011 3:57:03 PM
Registered User
Joined: 10/10/2007
Posts: 22
Michael T, That works for the Daily chart. However... I'm interested in The hourly and 5 min chart crossing yesterday's close.

Thanks,
Joe
StockGuy
Posted : Wednesday, June 29, 2011 4:25:39 PM

Administration

Joined: 9/30/2004
Posts: 9,187

This should do it.  Will work on any time frame and return True when price crosses up or down through the previous day's close.

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.1 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Price crossing prev day close
'|*** Example: if price.percentChange > 1 then pass
'|******************************************************************


Static prevDayClose As Single
Static prevDay As Single

If isFirstBar Then
 prevDay = price.DateValue().day
End If

Dim currDay As Integer = price.DateValue().day

If currDay <> prevDay Then
 prevDay = currDay
 prevDayClose = price.close(1) 
End If
If prevDayClose > 0 Then
 If (price.close(1) < prevDayClose And price.close > prevDayClose) Or _
  (price.close(1) > prevDayClose And price.close < prevDayClose) Then pass 
End If

fowlie48
Posted : Friday, July 1, 2011 12:13:54 AM
Registered User
Joined: 10/10/2007
Posts: 22
I could not get it to work. I just cut and paste into new real code condition.

Joe
StockGuy
Posted : Friday, July 1, 2011 10:02:23 AM

Administration

Joined: 9/30/2004
Posts: 9,187
If you copy the header through  End If, you can just right-click on the chart in StockFinder and select Paste. 

After you create the condtion, right click on the condition and Paint Price History so you can see where it's returning True. Make sure your chart is set to an intraday time frame.
fowlie48
Posted : Saturday, July 2, 2011 1:31:04 AM
Registered User
Joined: 10/10/2007
Posts: 22
It paints fine, however when I use it as a sort it brings back all symbols indicating greater than 50 bars. This is on a 5 minute time frame.

Joe
StockGuy
Posted : Saturday, July 2, 2011 11:05:42 AM

Administration

Joined: 9/30/2004
Posts: 9,187
That means that none crossed the previous days price in the last 50 bars which would have been since around 11:50am on July 1.  I just spot-checked about 100 symbols and none of them crossed over the previous day's close since early in the trading day on Friday.
fowlie48
Posted : Wednesday, July 6, 2011 1:09:51 PM
Registered User
Joined: 10/10/2007
Posts: 22
thanks, your right.
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.