Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Price with Woodies Pivots for Amibroker (AFL)
kaiji
about 15 years ago
Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:

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

By Larry Jameson – cljameson [at] hotmail.com

Indicator / Formula

Copy & Paste Friendly
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
////////////////////////////
// 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);

1 comments

1. chandrasekher

how to use these pivots plz explain

Leave Comment

Please login here to leave a comment.

Back