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.


  • Topics

  • Posts

    • 📁 Population in 2100, as projected by UN Population Division.   🇮🇳 India: 1,533 million 🇨🇳 China: 771 million 🇳🇬 Nigeria: 546 million 🇵🇰 Pakistan: 487 million 🇨🇩 Congo: 431 million 🇺🇸 US: 394 million 🇪🇹 Ethiopia: 323 million 🇮🇩 Indonesia: 297 million 🇹🇿 Tanzania: 244 million 🇪🇬 Egypt: 205 million 🇧🇷 Brazil: 185 million 🇵🇭 Philippines: 180 million 🇧🇩 Bangladesh: 177 million 🇳🇪 Niger: 166 million 🇸🇩 Sudan: 142 million 🇦🇴 Angola: 133 million 🇺🇬 Uganda: 132 million 🇲🇽 Mexico: 116 million 🇰🇪 Kenya: 113 million 🇷🇺 Russia: 112 million 🇮🇶 Iraq: 111 million 🇦🇫 Afghanistan: 110 million   @FinancialWorldUpdates Profits from free accurate cryptos signals: https://www.predictmag.com/   
    • “If the West finds itself falling behind in AI, it won’t be due to a lack of technological prowess or resources. It won’t be because we weren’t smart enough or didn’t move fast enough. It will be because of something many of our Eastern counterparts don’t share with us: fear of AI.   The root of the West's fear of AI can no doubt be traced back to decades of Hollywood movies and books that have consistently depicted AI as a threat to humanity. From the iconic "Terminator" franchise to the more recent "Ex Machina," we have been conditioned to view AI as an adversary, a force that will ultimately turn against us.   In contrast, Eastern cultures have a WAY different attitude towards AI. As UN AI Advisor Neil Sahota points out, "In Eastern culture, movies, and books, they've always seen AI and robots as helpers and assistants, as a tool to be used to further the benefit of humans."   This positive outlook on AI has allowed countries like Japan, South Korea, and China to forge ahead with AI development, including in areas like healthcare, where AI is being used to improve the quality of services.   The West's fear of AI is not only shaping public opinion but also influencing policy decisions and regulatory frameworks. The European Union, for example, recently introduced AI legislation prioritizing heavy-handed protection over supporting innovation.   While such measures might be well-intentioned, they risk stifling AI development and innovation, making it harder for Western companies and researchers to compete.   Among the nations leading common-sense AI regulation, one stands out for now: Singapore.” – Chris C Profits from free accurate cryptos signals: https://www.predictmag.com/ 
    • $NFLX Netflix stock hold at 556.59 support or breakdown?  https://stockconsultant.com/?NFLX
    • $RDNT Radnet stock flat top breakout watch, https://stockconsultant.com/?RDNT
    • $GNK Genco Shipping stock narrow range breakout watch, also see $GOGL https://stockconsultant.com/?GNK
×
×
  • Create New...

Important Information

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