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 |

Gap Fill Daily Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
pianopilot
Posted : Monday, May 8, 2017 1:31:27 PM
Registered User
Joined: 5/27/2011
Posts: 45

Hi Bruce,

Gap Fill Daily

Please help with a formula for Gap Fill in StockFinder.  Gap is defined as Price distance from C(1) to Open.  The Gap can be either Up or Down.  Gap Fill must occur the next day, and must at a Minimun Completely fill the Gap, but price movement of the Fill may Continue past the C(1).  For Instance price of stock XYZ closes at $10.00 Yesterday.  This morning it Opens at $12.00, so there is an Up Gap of $2.00.  To fill the Gap today, XYZ must drop a Minimum of $2.00 back to $10.00, C(1) during today's trading, but price can drop Past the fill mark of $10.00 to $9.75 or less.

Can you help to design two (2) separate Real Code Conditions to verify Gap Fills, One for Up Gaps and One for Down Gaps? Input variables would be Gap Size in %, and Direction of Gap, Up or Down.  Would need to be for Intra-Day, and Daily time Frames.

Also, is there a way to determine the TIME of the Gap Fill? If I am in 1-hour Time Frame, will I know the Gap was filled during that Time Segment, say 11:00 am to 12:00 pm? It would be great to know the specifice Time that the Gap was Filled.

Thanks for your help.  I am open to questions or suggestions.

Ed

 

 

Bruce_L
Posted : Monday, May 8, 2017 4:13:56 PM


Worden Trainer

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

Maybe something like the following RealCode Condition? You can set the Percent setting to a positive value to check for gaps up and to a negative value to check for gaps down.

It will start returning true on the first bar where the gap was filled during the day, but there really isn't a way to make it return a time to use in a WatchList Column for example.

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Filled Gap
'|******************************************************************
'# Percent = UserInput.Single = 1
Static Filled As Boolean
Static Gapped As Boolean
Static FirstDay As Boolean
Static PrevClose As Single
If isFirstBar Then
	Filled = False
	Gapped = False
	FirstDay = False
	PrevClose = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
	Filled = False
	Gapped = False
	FirstDay = True
	PrevClose = Price.Last(1)
	If Percent > 0 Then
		If Price.Open >= (1 + Percent / 100) * PrevClose Then
			Gapped = True
		End If
	Else If Percent < 0 Then
		If Price.Open <= (1 + Percent / 100) * PrevClose Then
			Gapped = True
		End If
	End If
End If
If FirstDay = True Then
	If Gapped = True Then
		If Filled = True Then
			Pass
		Else If Percent > 0 Then
			If Price.Low <= PrevClose Then
				Filled = True
				Pass
			End If
		Else If Percent < 0 Then
			If Price.High >= PrevClose Then
				Filled = True
				Pass
			End If
		End If
	End If
Else
	SetIndexInvalid
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
pianopilot
Posted : Monday, May 8, 2017 6:31:11 PM
Registered User
Joined: 5/27/2011
Posts: 45

Hi Bruce,

Thanks or the condition formulas!!  They work great, both Daily and Intra-day.

Ed

Bruce_L
Posted : Tuesday, May 9, 2017 7:21:55 AM


Worden Trainer

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

You're welcome.



-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.