Go Back   Traders Laboratory > Trading Resources > Trading Indicators > Coding Forum

Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Bookmarks
del.icio.us StumbleUpon Google Digg Facebook Furl Reddit Netscape

 
LinkBack (1) Thread Tools Display Modes Language
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-30-2008, 05:23 PM
Mr.Money Mr.Money is offline
Registered Trader

 
Join Date: Jan 2008
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
Auto-Pivot Points with Price

Hello Guys

I found this indicator and seems very promising. It automatically calculates pivots for Daily/weekly and monthly. It also shows the price at the axis.

If anybody could code the mid-ranges for the daily pivots will be nice.

Here's the code for the pivot point


[LegacyColorValue = TRUE];

{ Support and Resistance Pivot Indicator
Written by: HamFon
Contact: ncrowle@sprintmail.com
Date: 06/11/2004, original 12/02/2002
Revision: 1.04
Status: Gnu Public License - this indicator may be used or shared freely with
no fee, as long as this original header comment is included.
Purpose: Displays Support and Resistance values based on "Pivot" (Typical Price).
}

{ Unfortunately, TradeStation only will plot four simultaneous lines per Indicator instance.
Yes - I know all about creating TrendLines - but they have their own limitations, and use
more resources that must be carefully tracked.

Therefore - since we want to plot five lines, you need to load two different indicators:
Ham Pivot Lines, and Ham Pivot Lines2.

The code below is for both - one section or the other is commented out.
}

inputs: Day0Week1Month2 (0);

vars: Support1(0), Support2(0), RSPivot(0), Resistance1(0), Resistance2(0);
vars: SaveHigh(0), SaveLow(0), SaveClose(0), SaveSession(0);

SaveSession = CurrentSession(0);
if SaveSession <> SaveSession[1] and (
Day0Week1Month2 = 0 or
(Day0Week1Month2 = 1 and DayOfWeek (Date) < DayOfWeek (Date[1])) or
(Day0Week1Month2 = 2 and DayOfMonth (Date) < DayOfMonth (Date[1]))
) then begin
RSPivot = (SaveHigh + SaveLow + SaveClose) / 3;
Resistance1 = 2 * RSPivot - SaveLow;
Support1 = 2 * RSPivot - SaveHigh;
Resistance2 = RSPivot + SaveHigh - SaveLow; { equivalent to Pivot+(Resistance1-Support1) }
Support2 = RSPivot - SaveHigh + SaveLow; { equivalent to Pivot-(Resistance1-Support1) }
SaveHigh = 0;
SaveLow = 0;
SaveClose = 0;
end;

if SaveHigh = 0 or high > SaveHigh then
SaveHigh = high;
if SaveLow = 0 or low < SaveLow then
SaveLow = low;
SaveClose = close;

if Support1 > 0 then begin

{ This code is for Ham Pivot Lines2 - comment out for Ham Pivot Lines }
plot1 (RSPivot, "Pivot");
{}

{ This code is for Ham Pivot Lines - comment out for Ham Pivot Lines2
plot1 (Resistance2, "R2");
plot2 (Resistance1, "R1");
plot3 (Support1, "S1");
plot4 (Support2, "S2");
}
end;


here's the code for S/R lines
[LegacyColorValue = TRUE];

{ Support and Resistance Pivot Indicator
Written by: HamFon
Contact: ncrowle@sprintmail.com
Date: 06/11/2004, original 12/02/2002
Revision: 1.04
Status: Gnu Public License - this indicator may be used or shared freely with
no fee, as long as this original header comment is included.
Purpose: Displays Support and Resistance values based on "Pivot" (Typical Price).
}

{ Unfortunately, TradeStation only will plot four simultaneous lines per Indicator instance.
Yes - I know all about creating TrendLines - but they have their own limitations, and use
more resources that must be carefully tracked.

Therefore - since we want to plot five lines, you need to load two different indicators:
Ham Pivot Lines, and Ham Pivot Lines2.

The code below is for both - one section or the other is commented out.
}

inputs: Day0Week1Month2 (0);

vars: Support1(0), Support2(0), RSPivot(0), Resistance1(0), Resistance2(0);
vars: SaveHigh(0), SaveLow(0), SaveClose(0), SaveSession(0);

SaveSession = CurrentSession(0);
if SaveSession <> SaveSession[1] and (
Day0Week1Month2 = 0 or
(Day0Week1Month2 = 1 and DayOfWeek (Date) < DayOfWeek (Date[1])) or
(Day0Week1Month2 = 2 and DayOfMonth (Date) < DayOfMonth (Date[1]))
) then begin
RSPivot = (SaveHigh + SaveLow + SaveClose) / 3;
Resistance1 = 2 * RSPivot - SaveLow;
Support1 = 2 * RSPivot - SaveHigh;
Resistance2 = RSPivot + SaveHigh - SaveLow; { equivalent to Pivot+(Resistance1-Support1) }
Support2 = RSPivot - SaveHigh + SaveLow; { equivalent to Pivot-(Resistance1-Support1) }
SaveHigh = 0;
SaveLow = 0;
SaveClose = 0;
end;

if SaveHigh = 0 or high > SaveHigh then
SaveHigh = high;
if SaveLow = 0 or low < SaveLow then
SaveLow = low;
SaveClose = close;

if Support1 > 0 then begin

{ This code is for Ham Pivot Lines2 - comment out for Ham Pivot Lines
plot1 (RSPivot, "Pivot");
}

{ This code is for Ham Pivot Lines - comment out for Ham Pivot Lines2 }
plot1 (Resistance2, "R2");
plot2 (Resistance1, "R1");
plot3 (Support1, "S1");
plot4 (Support2, "S2");

end;

Reply With Quote
Reply

LinkBacks (?)
LinkBack to this Thread: http://www.traderslaboratory.com/forums/f56/auto-pivot-points-with-price-3355.html
Posted By For Type Date
Traders Laboratory This thread Refback 01-30-2008 05:24 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
S/R and PIVOT POINTS john15689 Beginners Forum 4 02-01-2008 08:26 AM
Entry using pivot points Mr.Money Technical Analysis 4 01-26-2008 11:57 AM
Auto Pivot Point Indicator with Labels Soultrader Trading Indicators 3 09-29-2007 11:08 AM
An Auto Pivot Level Indicator GCB Trading Indicators 8 07-31-2007 09:17 AM
ATR and Pivot Points earsha Technical Analysis 12 01-22-2007 03:26 PM


All times are GMT -4. The time now is 07:17 PM.

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59