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 Points Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
ilbuildit
Posted : Friday, November 13, 2009 5:12:00 PM
Registered User
Joined: 6/22/2005
Posts: 87
Hi.

I am using some real code that was posted by bruce on June 3, 2008.

'# PointType = UserInput.String = PP
'# TimeFrame = UserInput.String = D
Static Time As Date
Static High(1) As Single
Static Low(1) As Single
Static Close(1) 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
End If
If PointType = "PP" Then
    Plot = (High(1) + Low(1) + Close(1)) / 3
Else If PointType = "S1" Then
    Plot = 2 * (High(1) + Low(1) + Close(1)) / 3 - High(1)
Else If PointType = "S2" Then
    Plot = (High(1) + Low(1) + Close(1)) / 3 - High(1) + Low(1)
Else If PointType = "S3" Then
    Plot = Low(1) - 2 * (High(1) - (High(1) + Low(1) + Close(1)) / 3)
Else If PointType = "R1" Then
    Plot = 2 * (High(1) + Low(1) + Close(1)) / 3 - Low(1)
Else If PointType = "R2" Then
    Plot = (High(1) + Low(1) + Close(1)) / 3 + High(1) - Low(1)
Else If PointType = "R3" Then
    Plot = High(1) + 2 * ((High(1) + Low(1) + Close(1)) / 3 - Low(1))
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

Prices out correctly but doesn't plot the pivots correctly on the chart. I have them all on "time frame = Day" and point type = R3 R2 R1 PP S1 S2 S3 each as a seperate indicator.

If I push the period key twice to bring up the box with all the prices on the indicators they are all correct, but on some days the PP is plotted below all the other S's and R's.

I will share the chart under "Pivot Point Plots" if you wish to review what is happening.

Thank you in advance.

Bruce_L
Posted : Friday, November 13, 2009 5:18:14 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
It reads like you aren't Plotting the RealCode Indicators on the Price History Scale. Right-click on each of them and select Scaling | Scale With | Price History.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ilbuildit
Posted : Friday, November 13, 2009 5:21:18 PM
Registered User
Joined: 6/22/2005
Posts: 87

I love it when it's simple. I couldn't see the forest for the trees!

Thank you as always Bruce!

Have a good weekend...

Bruce_L
Posted : Friday, November 13, 2009 5:36:05 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.