Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Price with Woodies Pivots
Author/Uploader: Larry Jameson - cljameson [at] hotmail.com
Date/Time added: 2004-11-16 18:19:36
Origin:
Keywords: Price Woodie Woodies Pivots
Level: semi-advanced
Flags: indicator

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

Produces a price chart with Woodies Pivots. Only the pivots within a specified range are displayed to prevent autoscaling problems

Formula:

////////////////////////////
// Price with Woodies Pivots - Coded by Wring
// Amibroker 4.63.1
////////////////////////////
//
// Note:  Turn on GridLine boxes "Middle" and "Show Dates" 
//        in the dialogue box just below
//
//	  Set the Background Colour to DarkOliveGreen
//	  Set the Axes Colour to White
//
////////////////////////////////////
// Calculate and plot Woodies Pivots
////////////////////////////////////
function Pivots()
{
TimeFrameSet(inDaily);
//global R1,R2,S1,S2,PP,ColorR,ColorS,ColorP;
PP  =  round((Ref(H,-1) + Ref(L,-1) + O*2) / 4);
R1  =  (2 * PP) - Ref(L,-1);
S1  =  (2 * PP)  - Ref(H,-1);
R2  =  (PP - S1) + R1;
S2  =  PP - (R1 - S1);
TimeFrameRestore();

ColorR = colorRose; 		// Resistance Bars colour
ColorS = colorOrange; 	// Support Bars colour
ColorP = colorSkyblue; 	// Woodies Pivot colour

// set all pivots but last to close +5
// This is done to eliminate problems with autoscaling
//
for (i=0;i<(BarCount-2);i++)
{
	PP[i] = H[i]+5;
	R1[i] = H[i]+5;
	R2[i] = H[i]+5;
	S1[i] = H[i]+5;
	S2[i] = H[i]+5;
}
//
// I want the pivot line to emerge as a straight line from the right
// side of the chart
//
for (i=BarCount-2;i>(BarCount-13);i--)//set the last bars to the final PP
value
{
	PP[i] = PP[BarCount-1];
	R1[i] = R1[BarCount-1];
	R2[i] = R2[BarCount-1];
	S1[i] = S1[BarCount-1];
	S2[i] = S2[BarCount-1];

	ColorR[i] = colorRose;
	ColorS[i] = colorOrange;
	ColorP[i] = colorSkyblue;
}
//
// Conceal all but the trailing portion of the line
//
for (i=0;i<BarCount-10;i++) //hide the line except most recent 10 bars
{
	ColorR[i] = ColorS[i] = ColorP[i] = colorDarkOliveGreen;
}

//
// If price is above or below current price by more than this 
// amount then the pivot won't print.  Trying to print offscreen
// values causes problems with autoscaling
//
tolerance = 25;  
//
// Over how many bars should the tolerance be applied
//
range=30;
// 
// set up some constants
//
LastBar = BarCount-1;
HiVal = HHV(H,range);
LoVal = LLV(L,range);
style = styleLine;

//
//only plot pivots close to price
//
if (PP[LastBar]<(HiVal[LastBar]+tolerance) AND 
						PP[LastBar]>(LoVal[LastBar]-tolerance))
{
//	PlotOHLC(PP,PP,PP,PP,"PP",colorSkyblue);
	Plot(PP,"PP",ColorP,style);
}
if (R1[LastBar]<(HiVal[LastBar]+tolerance) )//only plot pivots close to close
price
{
	Plot(R1,"R1",ColorR,style);
}
if (R2[LastBar]<(HiVal[LastBar]+tolerance) )//only plot pivots close to close
price
{
	Plot(R2,"R2",ColorR,style);
}
if (S1[LastBar] > (LoVal[LastBar]-tolerance) )//only plot pivots close to close
price
{
	Plot(S1,"S1",ColorS,style);
}
if (S2[LastBar] > (LoVal[LastBar]-tolerance) )//only plot pivots close to close
price
{
	Plot(S2,"S2",ColorS,style);
}
}


// Main Program starts here

////////////////////////////
// Price with Woodies Pivots 
////////////////////////////
CCI14 = CCI(14);
LSMA = round(LinearReg( Close, 25 )); 
// Plot Woodies Pivots
pivots();

// Setup the title
TitleStr = Interval(2) + " " + Name() + ", " + 
			EncodeColor(colorPink) + 
			"Price=" + H + ", " + L + ", " + C + ", " + 
			EncodeColor(colorTurquoise) + "34EMA" +	",\n" +
			EncodeColor(colorYellow) + "25lsma" + 
			EncodeColor(colorCustom12) + ", " +
			EncodeColor(colorWhite) + Date();
Title = TitleStr;

// Plot the price bars
PlotOHLC(O,H,L,C,"Price",
		IIf(C >= Ref(C,-1),colorGreen,colorRed),styleCandle);

Plot(EMA(C,34),"ema34",colorTurquoise,styledashed | styleNoLabel);
Plot(LSMA,"lsma",colorYellow,styleLine | styleNoLabel);

Comments:

Brian

2004-11-16 21:41:59
Larry,

I get this error message. Any idea what I did wrong?? I just copied and pasted it...hmmmm.

Thanks,

Brian


Line 47, Column 1:
//

for (i=BarCount-2;i>(BarCount-13);i--)//set the last bars to the final PP

value

{
^

Error 23.
Syntax error
Brian

2004-11-16 21:43:28
Sorry Larry. I found what I did wrong!

Very Nice Code Larry!!! Thanks for sharing it!!

brian
Mike
mike.numa [at] dataentry.com.au
2004-11-17 08:00:45
Get this error
Any suggestions? Downloaded 18/11/2004
Line 179, Column 27:
PlotOHLC(O,H,L,C,"Price",

IIf(C >= Ref(C,-1),colorGreen,colorRed),styleCandle);



Plot(EMA(C,34),"ema34",colorTurquoise,styledashed | styleNoLabel);
-----------------------------------------------------------------^

Variable 'styledashed' used without having been initialized.
joe mama
joe [at] joemama.com
2004-11-18 21:35:55
Just change the styledashed to styleline. Not perfect but it works.
avi
y192 [at] 012.net.il
2004-11-23 23:27:25
Larry,
Could it working with AB v4.50
explain ??
das300 [at] tpg.com.au
2004-11-26 02:44:59
is there any referenceas to how to use it ... and i get this line much higher than the close at the end of bars ?? is this suypposed to happen ??

Paul
pyarwood [at] rogers.com
2004-11-27 20:08:14
Very nice thanks for the pivot setup
Any ideas on how I can get a OHLC on the tool tip when using just this pivot formula with the candles. I get PP R1 S1 and Price at the end of pointer but would like the OHLC.
sivakumar
aishvaryaus [at] vsnl.net
2006-11-12 10:00:22
dear sir

as per pivot finder or golden rose
is it possible to plot the arrows on this code to find the pivot changes

regds
SIVA
Tomasz Janeczko
tj at amibroker.com
2007-09-04 18:38:37
For all getting syntax errors: Don't copy-paste!

Instead use "Download Formula File" link. That way you get proper formula. If you copy-paste the lines may get wrapped.


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM