Gold Customer
Joined: 3/23/2005 Posts: 10
|
Can I write this formula into - Real Code : my indicator - to develop a pivot point indicator with support and resistance levels?
If I do this, then I should be able to pull it up as an indicator. My only other questipn is where will it be stored?
Also, are there any other special notations that I need to make when writing this code?
The calculation for a pivot point is shown below:
Pivot point (PP) = (High + Low + Close) / 3
Support and resistance levels are then calculated off the pivot point like so:
First level support and resistance:
First support (S1) = (2*PP) – High
First resistance (R1) = (2*PP) – Low
Second level of support and resistance:
Second support (S2) = PP – (High – Low)
Second resistance (R2) = PP + (High - Low)
or
Pivot (P) = (H + L + C) / 3
Resistance (R1) = (2 x P ) - L
R 2 = P + H - L
R 3 =H + 2 x ( P-L )
Support ( S1)= (2 x P ) -H
S2 = P - H + L
S3 = L - 2 x (H - P )
Thanks,
Mike TEXASTYPHOON
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The RealCode Programmers Reference is a good place to start learning RealCode. The following Webinars might also be of interest:
4/29/2009 - Intro to RealCode
6/2/2009 - Intro to RealCode Episode II
The basic idea you would use when creating your own Indicator for the Pivot Points based on the information you have provided would be to have just the following in the Code tab of a RealCode Indicator:
Plot = (Price.High + Price.Low + Price.Last) / 3
R1 would be:
Plot = 2 * (Price.High + Price.Low + Price.Last) / 3 - Price.Low
R2 would be:
Plot = (Price.High + Price.Low + Price.Last) / 3 + Price.High - Price.Low
R3 would be:
Plot = Price.High + 2 * ((Price.High + Price.Low + Price.Last) / 3 - Price.Low)
S1 would be:
Plot = 2 * (Price.High + Price.Low + Price.Last) / 3 - Price.High
S2 would be:
Plot = (Price.High + Price.Low + Price.Last) / 3 - Price.High + Price.Low
And S3 would be:
Plot = Price.Low - 2 * (Price.High - (Price.High + Price.Low + Price.Last) / 3)
That said, these RealCode Indicators would all Plot running Values based on the Price components of the current Bar. Many of the examples of possible interpretations of Pivot Points that can be found by searching the Shared Charts and Layouts in StockFinder for pivot (and by searching the forums as well) will give more sophisticated interpretations as would the Realcode in my Tuesday, June 03, 2008 1:41:05 PM ET post in the previously referenced Real Code Help topic.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|