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 |

Looking for a RealCode Condition to watch for a breakdown Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
brando_slc
Posted : Wednesday, April 13, 2016 11:49:20 AM
Registered User
Joined: 3/1/2016
Posts: 2

Hi Bruce, Hi all,

Is it possible to write a RealCode Condition to Pass under these circumstances? (5-min candles):


1) Change in VWAP from 10AM to 12PM is <0.25%

2) Stock was trading at or above VWAP before a breakdown

3) Price breaks down to at least 0.5% below the VWAP (as for time, let's say this happened over 30 min or less)

4) During that breakdown, the price fell at least 10x farther than the VWAP (If 0.5% = $0.60 price breakdown then $0.06 max VWAP breakdown over the same period)

5) Said price breakdown occured before 2:30PM

 

Thank you,

Brandon

 

Bruce_L
Posted : Friday, April 22, 2016 12:15:38 PM


Worden Trainer

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

Maybe something similar to the following RealCode Condition? Note that you will already have to have a VWAP on the chart with the correct name in order for the RealCode Condition to work.

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:VWAP Breakdown
'|******************************************************************
'# VWAP = chart.VWAPVolumeWeightedAveragePrice
Static StartVWAP As Single
Static State As Byte
Static CrossBar As Integer
Static FullDay As Boolean
If isFirstBar OrElse _
	Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
	State = 0
	CrossBar = 0
	If isFirstBar Then
		FullDay = False
	Else
		FullDay = True
	End If
End If
If Price.DateValue.TimeOfDay <= Date.Parse("14:30").TimeOfDay Then
	If Price.DateValue.TimeOfDay > Date.Parse("12:00").TimeOfDay Then
		If State = 2 Then
			If Price.Value >= VWAP.Value Then
				State = 3
			End If
		Else If State = 3 Then
			If Price.Value < VWAP.Value Then
				State = 4
				CrossBar = CurrentIndex - 1
			End If	
		End If
		If State = 4 Then
			If Price.Value >= VWAP.Value Then
				State = 2
			Else
				If Price.Value <= .995 * VWAP.Value Then
					Dim Ago As Integer = CurrentIndex - CrossBar
					If Price.Value(Ago) - Price.Value >= _
						10 * (VWAP.Value(Ago) - VWAP.Value(Ago)) AndAlso _
						Price.DateValue - Price.DateValue(Ago) <= _
						Date.Parse("00:30") - Date.Parse("00:00") Then
						State = 5
					End If
				End If
			End If
		End If
	Else If Price.DateValue.TimeOfDay = Date.Parse("10:00").TimeOfDay Then
		StartVWAP = VWAP.Value
		State = 1
	Else If Price.DateValue.TimeOfDay = Date.Parse("12:00").TimeOfDay Then
		If Math.Abs(VWAP.Value / StartVWAP - 1) <= .0025 Then
			State = 2
			If Price.Value >= VWAP.Value Then
				State = 3
			End If
		End If
	End If
End If
If FullDay = True Then
	If State = 5 Then
		Pass
	End If
Else
	SetIndexInvalid
End If


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