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
|
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
|
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
|
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
|
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
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|