Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Mr.Money

Auto-Pivot Points with Price

Recommended Posts

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;

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.