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 |

Pivot Point Bounce Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
pianopilot
Posted : Thursday, July 16, 2015 12:08:56 PM
Registered User
Joined: 5/27/2011
Posts: 45

Bruce,

Can you write Real Code for a specific area Just to the North or South of the Pivot Points with User Inputs? Such that the Rule excites when Price enters that specific area?

I.e. 1) Price < Pivot Point AND Including Price Down to x% Below PP.

      2) Price > PP AND Including Price Up to x% Above PP.

My theory is that Price will Bounce when it reaches these areas.  For Instance, if I am trading UP to PP, I don't want price o Quite reach PP, but too BOUNCE just before it reaches PP. ( Price <PP And Including Price Down to x% Below PP)

The Real Code you gave in an earlier post works great for drawing horizontal lines for the PP, S1, S2, R1, R2, etc. and with user inputs. But in doing a Back Scan, a Condition for Price <PP will necessarily include stocks too far South.  I want to limit the REACH South of PP by a Specific%.

And then a different code to excite when Price > PP AND Up to x% Above PP.

Thanks for your Help,

Ed

Bruce_L
Posted : Thursday, July 16, 2015 1:18:44 PM


Worden Trainer

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

Please try the following RealCode Condition. You will need to set Percent as positive if you want it above the pivot point and negative if you want it below the pivot point.

Real Code Help

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Pivot Point Bounce
'|******************************************************************
'# PointType = UserInput.String = PP
'# TimeFrame = UserInput.String = D
'# Percent = UserInput.Single = 1
Static Time As Date
Static High(1) As Single
Static Low(1) As Single
Static Close(1) As Single
Static Pivot As Single
Static Range As Single
Static MidRange As Single
If isFirstBar Then
	Time = CurrentDate
	High(0) = Price.High
	Low(0) = Price.Low
	Close(0) = Price.Last
	High(1) = Single.NaN
	Low(1) = Single.NaN
	Close(1) = Single.NaN
End If
If (TimeFrame = "D" And _
	Time.DayOfYear <> CurrentDate.DayOfYear) Or _
	(TimeFrame = "W" And _
	Time.DayOfWeek > CurrentDate.DayOfWeek) Or _
	(TimeFrame = "M" And _
	Time.Month <> CurrentDate.Month) Or _
	(TimeFrame = "Y" And _
	Time.Year <> CurrentDate.Year) Then
	High(1) = High(0)
	Low(1) = Low(0)
	Close(1) = Close(0)
	High(0) = Price.High
	Low(0) = Price.Low
	Close(0) = Price.Last
	If PointType = "PP" Then
		Pivot = (High(1) + Low(1) + Close(1)) / 3
	Else If PointType = "S1" Then
		Pivot = 2 * (High(1) + Low(1) + Close(1)) / 3 - High(1)
	Else If PointType = "S2" Then
		Pivot = (High(1) + Low(1) + Close(1)) / 3 - High(1) + Low(1)
	Else If PointType = "S3" Then
		Pivot = Low(1) - 2 * (High(1) - (High(1) + Low(1) + Close(1)) / 3)
	Else If PointType = "R1" Then
		Pivot = 2 * (High(1) + Low(1) + Close(1)) / 3 - Low(1)
	Else If PointType = "R2" Then
		Pivot = (High(1) + Low(1) + Close(1)) / 3 + High(1) - Low(1)
	Else If PointType = "R3" Then
		Pivot = High(1) + 2 * ((High(1) + Low(1) + Close(1)) / 3 - Low(1))
	End If
	Range = Math.Abs(Pivot * Percent / 200)
	MidRange = (Pivot * (2 + Percent / 100)) / 2
End If
If Math.Abs(Price.Last - MidRange) <= Range Then
	Pass
End If
Time = CurrentDate
High(0) = System.Math.Max(High(0), Price.High)
Low(0) = System.Math.Min(Low(0), Price.Low)
Close(0) = Price.Last


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
pianopilot
Posted : Friday, July 17, 2015 1:30:57 AM
Registered User
Joined: 5/27/2011
Posts: 45

Bruce,

Thanks for your help.  I see now that I need a small adjustment. 

Can you make the daily price below/ above the PP "caress," and not violate PP.  As it stands now, price action thoughut the day can violate PP. I don't care how much movement is in the daily price, if it is a small or large candle.

Where Today's Price is BELOW PP and within predefined limits...

Also Today's HIGH is < = PP

 

And where Today's Price is ABOVE PP and within predefned limits.. 

Also Today's LOW is > = PP

As you can see, I'm wanting the High of the day (in action below PP) not to violate PP, and vice versa, Low of the day (in action Above PP) not to violate PP.

Thanks so much for your help,

Ed

Bruce_L
Posted : Friday, July 17, 2015 8:40:57 AM


Worden Trainer

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

Please try the following RealCode Condition instead.

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Pivot Point Bounce
'|******************************************************************
'# PointType = UserInput.String = PP
'# TimeFrame = UserInput.String = D
'# Percent = UserInput.Single = 1
Static Time As Date
Static High(1) As Single
Static Low(1) As Single
Static Close(1) As Single
Static Pivot As Single
Static Range As Single
Static MidRange As Single
If isFirstBar Then
	Time = CurrentDate
	High(0) = Price.High
	Low(0) = Price.Low
	Close(0) = Price.Last
	High(1) = Single.NaN
	Low(1) = Single.NaN
	Close(1) = Single.NaN
End If
If (TimeFrame = "D" And _
	Time.DayOfYear <> CurrentDate.DayOfYear) Or _
	(TimeFrame = "W" And _
	Time.DayOfWeek > CurrentDate.DayOfWeek) Or _
	(TimeFrame = "M" And _
	Time.Month <> CurrentDate.Month) Or _
	(TimeFrame = "Y" And _
	Time.Year <> CurrentDate.Year) Then
	High(1) = High(0)
	Low(1) = Low(0)
	Close(1) = Close(0)
	High(0) = Price.High
	Low(0) = Price.Low
	Close(0) = Price.Last
	If PointType = "PP" Then
		Pivot = (High(1) + Low(1) + Close(1)) / 3
	Else If PointType = "S1" Then
		Pivot = 2 * (High(1) + Low(1) + Close(1)) / 3 - High(1)
	Else If PointType = "S2" Then
		Pivot = (High(1) + Low(1) + Close(1)) / 3 - High(1) + Low(1)
	Else If PointType = "S3" Then
		Pivot = Low(1) - 2 * (High(1) - (High(1) + Low(1) + Close(1)) / 3)
	Else If PointType = "R1" Then
		Pivot = 2 * (High(1) + Low(1) + Close(1)) / 3 - Low(1)
	Else If PointType = "R2" Then
		Pivot = (High(1) + Low(1) + Close(1)) / 3 + High(1) - Low(1)
	Else If PointType = "R3" Then
		Pivot = High(1) + 2 * ((High(1) + Low(1) + Close(1)) / 3 - Low(1))
	End If
	Range = Math.Abs(Pivot * Percent / 200)
	MidRange = (Pivot * (2 + Percent / 100)) / 2
End If
Time = CurrentDate
High(0) = System.Math.Max(High(0), Price.High)
Low(0) = System.Math.Min(Low(0), Price.Low)
Close(0) = Price.Last
If Math.Abs(Price.Last - MidRange) <= Range Then
	If Percent > 0 Then
		If Math.Abs(Low(0) - MidRange) <= Range Then
			Pass
		End If
	Else If Percent < 0 Then
		If Math.Abs(High(0) - MidRange) <= Range Then
			Pass
		End If
	End If
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
pianopilot
Posted : Friday, July 17, 2015 1:17:30 PM
Registered User
Joined: 5/27/2011
Posts: 45

Hi Bruce,

Thanks soooo.. much! The Condition works great!  And I like the fact that it whizzes through calculatons. It will be fun to work with.

Thanks again,

Ed

Bruce_L
Posted : Friday, July 17, 2015 1:24:27 PM


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.