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

Average/Typical Price Oscillator for Amibroker (AFL)
d9
about 9 years ago
Amibroker (AFL)

Rating:
2 / 5 (Votes 3)
Tags:
oscillator, amibroker

/**********************************************************************************/
/* Oscillates based on difference between Average Price (H+L+O+C)/4, and Typical Price (H+L+C)/3.
Results in a very smooth curve.
Accompanying Price Candles enhanced with Tail-Color based on adjustable Volume Percentage Rise or Fall
-Nick Molchanoff (d9)
/**********************************************************************************/

Screenshots

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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/**************************************************************************/
/* Oscillates based on difference between Average Price (H+L+O+C)/4, and Typical Price (H+L+C)/3.
Results in a very smooth curve.
Accompanying Price Candles enhanced with Tail-Color based on adjustable Volume Percentage Rise or Fall
   -Nick Molchanoff (d9)
/**************************************************************************/
_SECTION_BEGIN("Settings");
 
SetBarsRequired(10000,10000);
SetFormulaName("Sample System");
SetTradeDelays( 1, 1, 1, 1 );
SetOption( "initialequity", 100000 );
SetOption( "MaxOpenPositions", 3 );
SetOption( "PriceBoundChecking", 1 );
SetOption( "CommissionMode", 2 );
SetOption( "CommissionAmount", 8.00 );
SetOption( "UsePrevBarEquityForPosSizing", 1 );
SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle|chartLogarithmic);
PositionScore = 100/C;
PositionSize = -10;
GraphXSpace =15;
GraphLabelDecimals = 2;
 
_SECTION_END();
 
/**********************************************************************************/
 
_SECTION_BEGIN("UsefulDefs");
 
Close1 = C1 = Ref(C, -1);
upClose = upC = (C > C1);
downClose = dnC = (C <= C1);
UpDay = upD =( C > O);
downDay = dnD = (C <= O);
 
open1 = O1 = Ref(O, -1);
upOpen = upO = (O > O1);
downOpen = dnO = (O <= O1);
upDay = upD = (O <= C);
downDay = dnD = (O > C);
 
openCloseDiff = ocd = abs(C-O);
 
High1 = H1 = ref(H, -1);
upHigh = upH = (H > H1); 
downHigh = dnH = (H <= H1);
 
Low1 = L1 = Ref(L, -1);
upLow = upL = (L > L1); 
downLow = dnL = L <= L1;
 
top = t= Max(O, C);
bot = b= Min(O, C);
avp = av4 = ((O+H+L+C)/4);
typ = tp3= ((H+L+C)/3);
 
upperShadow = us = H-t;
lowerShadow = ls = b-L;
shadows = shds = us+ls;
  
downPressure = dnP = IIf(upd,shds, ocd + shds);
upPressure = upP =  IIf(upd, ocd + shds, shds);
 
Volume1 = V1 = Ref(V, -1);
upVolume =  upV =V > v1;
fib=1.618033889;
 
Vc= Param("Volatility channel -",10,2,14);
Up=HHV(((((H+L+C)/3)*2)- H),Vc);
Lo=LLV(((((H+L+C)/3)*2)- L),Vc);
 
upDownColor = udcolor = IIf(C>O, colorDarkGreen, colorDarkRed);
breakOutColor = boColor = IIf(C>up AND upV, colorBrightGreen, colorRed);
nColor = IIf(C>up, bocolor, udcolor);
 
per = Param("per", 15, 2, 256, 1);
 
_SECTION_END();
 
 
/**************************************************************************/
 
_SECTION_BEGIN("Big Name");
 
x=Param( "xposn",1,-1000,1000,1);
y=Param( "yposn",10,-1000,1000,1);
 
GfxSetBkMode(0);
GfxSelectFont"Tahoma", 13, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(),  x+3, y+2 );
GfxTextOut(FullName(), x+73, y+2 );
GfxTextOut(MarketID(1), x+3, y+22 );
GfxTextOut(IndustryID(1), x+73, y+22 );
GfxTextOut( "Avg/Typ Price Oscillator",  x+3, y+42 );
 
_SECTION_END();
 
/**************************************************************************/
 
_SECTION_BEGIN("TITLE");
 
PrChgPct = (C-Ref(C,-1))*100/Ref(C,-1);
PrChgAmt = C-Ref(C,-1);
_N(Title =
  
"\n"+"\n"+"\n"+"\n"+"\n"+
//Basics...
EncodeColor(colorSkyblue) +"High  = " + EncodeColor(colorBrightGreen) + NumToStr(H,1.2)+
EncodeColor(colorSkyblue) +"  Low  = " + EncodeColor(colorRed) + NumToStr(L,1.2) +
"\n"+
EncodeColor(colorSkyblue) +"Open = " + EncodeColor(colorSkyblue) + NumToStr(o,1.2) +
EncodeColor(colorSkyblue) +"  Close =" +
// plus extra info...
WriteIf( Ref(C,-1)<C ,
EncodeColor(colorBrightGreen)+""+NumToStr(C,1.2) +
"\n"+ //if up...
EncodeColor(colorSkyBlue)+""+"(Chg %)" +
EncodeColor(colorBrightGreen)+"  "+ NumToStr(PrChgPct,1.2)+"%" +
EncodeColor(colorSkyBlue)+"  "+"(Chg Amt)"+
EncodeColor(colorBrightGreen)+"  "+NumToStr(PrChgAmt,1.2)
+"\n"+EncodeColor(colorSkyBlue)+""+"(tp3)"+
EncodeColor(colorBrightGreen)+"  "+NumToStr(tp3,1.2)+
EncodeColor(colorSkyBlue)+"  "+"(av4)"+
EncodeColor(colorBrightGreen)+"  "+NumToStr(av4,1.2),
// else if down
EncodeColor(colorOrange)+"  " +
EncodeColor(colorRed)+""+NumToStr(C,1.2) +
"\n"+
EncodeColor(colorSkyBlue)+""+"(Chg %)" +
EncodeColor(colorRed)+"  "+ NumToStr(PrChgPct,1.2)+"%" +
EncodeColor(colorSkyBlue)+"  "+"(Chg Amt)" +
EncodeColor(colorRed)+"  "+NumToStr(PrChgAmt,1.2)
+"\n"+EncodeColor(colorSkyBlue)+""+"(tp3)"+
EncodeColor(colorRed)+"  "+NumToStr(tp3,1.2)+
EncodeColor(colorSkyBlue)+"  "+"(av4)"+
EncodeColor(colorRed)+"  "+NumToStr(av4,1.2)
)
  
+"\n"+EncodeColor(colorYellow)+ "Volume  ="
+"  "+
WriteIf( Ref(V,-1)<V , EncodeColor(colorLime) +WriteVal( V, 1.0 ), EncodeColor(colorRed) +WriteVal( V, 1.0 ))
 
+"\n"
+"\n"
);
 
_SECTION_END();
 
/**************************************************************************/
 
_SECTION_BEGIN("AvgTyp Osc");
 
per=Param( "Per", 15, 2, 60, 1);
sep = Param("Sep", 0, -10, 10, 1);
matp3=EMA(tp3, per);
maav4 =EMA(av4,per+sep);
diff= matp3-maav4;
// pato: Percent Average/Typical Price Oscillator
pato = 100*diff/maav4;
clr = IIf(matp3>maav4, colorGreen, colorRed);
//Plot(pato, "pato", clr, styleHistogram);
pvcolor = IIf(pato>0, colorDarkGreen, colorDarkRed);
minclip =0; maxclip = 0;
PlotOHLC(pato,pato,0,pato, "", pvColor, styleCloud |styleNoLabel | styleClipMinMax , minclip, maxclip, Null, -2, null );
Plot(pato, "pato", clr, styleLine|styleNoLabel);
Plot(matp3, "matp3", colorPalegreen, styleLine|styleLeftAxisScale);
Plot(maav4, "maav4", colorOrange, styleline|styleLeftAxisScale);
 
_SECTION_END();
 
_SECTION_BEGIN("Price w Volume Colored Shadows");
 
per = Param("per", 15, 1, 256, 1);
t = Max(O, C);
b = Min(O, C);
md = (t+b)/2;
 
hv = HHV(V, per);
lv = LLV(V, per);
noDiv0 = 0.000001;
diffV = hv-lv + noDiv0;
 
pv = b +  ( ( (V*1.2 - lv) * ( t - b ) ) / diffV ) ;
pv1=Ref(pv, -1);
v1= Ref(V, -1);
av= wilders(V, per);
PriceOn = ParamToggle("Show Price"," No|Yes", 1);
 
if (PriceOn)
{
Plot(c, "c", colorDefault, styleCandle|styleLeftAxisScale);
pvcolor = IIf(v >av , colorYellow, colorDarkTeal);
Plot( pv, "pv", pvcolor, styleBarNoTicks | styleLeftAxisScale|styleNoLabel, Null, Null, Null, -1, 3);
Plot(0,"0",colorWhite,styleDashed|styleNoLabel | StyleNoTitle);
Plot(0,"0",colorWhite,styleDashed|styleNoLabel | StyleNoTitle);
}
 
_SECTION_END();

2 comments

1. shindeamar

hi ,

we got one error line no. 194

2. hotaro3

Change styleBarNoTicks to StyleBar for removing error

Leave Comment

Please login here to leave a comment.

Back