Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Backtest (and real time scan) for High of Day at certain time Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Onereason
Posted : Monday, December 16, 2013 11:58:59 AM
Registered User
Joined: 10/7/2004
Posts: 56

Hi Bruce,

I want to scan for stocks that are making a new high (and low in another scan) of the day at certain times of the day. For example

If last is new high of day and time is between 1 PM  and 2 PM then pass

Can that be done?  Thanks in advance.

Bruce_L
Posted : Monday, December 16, 2013 4:06:36 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The following RealCode Condition should return for any bars on an intraday chart which have new highs between 1:00 PM and 2:00 PM ET.

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:New High Between Times
'|******************************************************************
'# Cumulative
Static DayHigh As Single
Static DayLow As Single
If isFirstBar Then
	DayHigh = Single.NaN
	DayLow = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
	DayHigh = Price.High
	DayLow = Price.Low
End If
If Price.High > DayHigh Then
	DayHigh = Price.High
	If Date.Parse("13:00").TimeOfDay <= Price.DateValue.TimeOfDay AndAlso _
		Price.DateValue.TimeOfDay <= Date.Parse("14:00").TimeOfDay Then
		Pass
	End If
End If
If Price.Low < DayLow Then
	DayLow = Price.Low
End If

You can change the "13:00" and "14:00" in the RealCode to change the start and end times. You would need to put something similar in the If Price.Low < DayLow Then section to do something similar for new lows.

You could use the RealCode Condition as a Rule in BackScanner to backtest it.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Onereason
Posted : Wednesday, December 18, 2013 8:20:01 AM
Registered User
Joined: 10/7/2004
Posts: 56

Bruce, you ROCK!!  

going to work on implementing it now.

Onereason
Posted : Saturday, December 21, 2013 10:53:08 AM
Registered User
Joined: 10/7/2004
Posts: 56

Hi Bruce, 

what does "'# Cumulative" do?

and I would like to use this as an indicator and condition, is there any reason why I can't

Bruce_L
Posted : Monday, December 23, 2013 12:55:40 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The '# Cumulative line lets StockFinder know to use all of the available data for the calculations instead of trying to optimize the condition by using less data when it isn't being used on the chart.

The RealCode Condition is just that, a condition (which can be used in the same way as any other condition) and not an indicator, but I cannot think of any reasons you could not plot the RealCode Condition as True Markers on the chart.

Just drag and drop the condition onto the chart or right-click on the condition and select Show True Markers (you can right-click on the condition and select Edit True Markers to change the settings).



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.