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

adx for Amibroker (AFL)

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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
_SECTION_BEGIN("PARABOLIC SAR");
 
/////////////////////////////////
 
// Parabolic SAR re-implemented in
 
// native AFL.
 
//
 
// Example of for/if/else control statements
 
//
 
// Requires:
 
// AmiBroker 4.31.1
 
//
 
// Written by: Tomasz Janeczko
 
  
 
IAF = 0.01;       // acceleration factor
 
MaxAF = 0.02;     // max acceleration
 
  
 
psar = Close;    // initialize
 
long = 1;        // assume long for initial conditions
 
af = IAF;         // init acelleration factor
 
ep = Low[ 0 ];   // init extreme point
 
hp = High [ 0 ];
 
lp = Low [ 0 ];
 
  
 
for( i = 2; i < BarCount; i++ )
 
{
 
   if ( long )
 
   {
 
       psar [ i ] = psar [ i-1 ] + af * ( hp - psar [ i-1 ] );
 
   }
 
   else
 
   {
 
       psar [ i ] = psar [ i-1 ] + af * ( lp - psar [ i-1 ] );
 
   }
 
  
 
   reverse =  0;
 
   //check for reversal
 
   if ( long )
 
   {
 
       if ( Low [ i ] < psar [ i ]  )
 
       {
 
          long = 0; reverse = 1; // reverse position to Short
 
          psar [ i ] =  hp;       // SAR is High point in prev trade
 
          lp = Low [ i ];
 
          af = IAF;
 
       }
 
   }
 
   else
 
   {
 
       if ( High [ i ] > psar [ i ]  )
 
       {
 
          long = 1; reverse = 1;        //reverse position to long
 
          psar [ i ] =  lp;
 
          hp = High [ i ];
 
          af = IAF;
 
       }
 
   }
 
  
 
   if ( reverse == 0 )
 
   {
 
       if ( long )
 
       {
 
          if ( High [ i ] > hp )
 
          {
 
              hp = High [ i ];
 
              af = af + IAF;
 
              if( af > MaxAF ) af = MaxAF;
 
          }
 
             
 
          if( Low[ i - 1 ] < psar[ i ] ) psar[ i ] = Low[ i - 1 ];
 
          if( Low[ i - 2 ] < psar[ i ] ) psar[ i ] = Low[ i - 2 ];
 
       }
 
       else
 
       {
 
          if ( Low [ i ] < lp )
 
          {
 
              lp = Low [ i ];
 
              af = af + IAF;
 
              if( af > MaxAF ) af = MaxAF;
 
          }
 
              
 
          if( High[ i - 1 ] > psar[ i ] ) psar[ i ] = High[ i - 1 ];
 
          if( High[ i - 2 ] > psar[ i ] ) psar[ i ] = High[ i - 2 ];
 
  
 
       }
 
   }
 
}
 
  
 
Plot( Close, "Price", colorBlack, styleCandle );
 
Plot( psar, "SAR", colorRed, styleDots | styleNoLine | styleThick );
 
range = 30;//Param("Periods", 14, 2, 200, 1 );
 
ADXi=ADX(range);
 
PDIi=PDI(range);
 
MDIi=MDI(range);
 
//Plot( ADXi=ADX(range), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue ), ParamStyle("ADX style", styleThick ) );
 
//Plot( PDIi=PDI(range), "", ParamColor( "+DI color", colorGreen ), ParamStyle("+DI style") );
 
//Plot( MDIi=MDI(range), "", ParamColor( "-DI color", colorRed ), ParamStyle("-DI style") );
 
uptrend=PDIi>MDIi;//+di greater than -di
 
downtrend=MDIi>PDIi;//-di greater than +di
 
Ribboncol=IIf(upTrend,colorGreen, IIf(downtrend,colorRed, colorBlack));
 
Plot(6, "", Ribboncol, styleOwnScale|styleArea|styleNoLabel, -7.5,100);
 
  
 
Buy=(Cross(L,psar) OR Cross(Ref(L,-1),Ref(psar,-1)))  AND uptrend;
 
Sell=(Cross(psar,H) OR Cross(Ref(psar,-1),Ref(H,-1)))  AND downtrend;
 
PlotShapes(Sell*shapeDownArrow,colorRed);
 
PlotShapes(Buy*shapeUpArrow,colorGreen);
 
AlertIf (Buy, "SOUND C: \ \ Program Files \ \ amibroker \ \ RekamSuara \ \ Beli.wav"
 
 ,"Audio alert", 2);
 
 AlertIf (Sell, "SOUND C: \ \ Program Files \ \ amibroker \ \ RekamSuara \ \ Jual.wav"
 
 ,"Audio alert", 2);
 
  
 
_SECTION_END();
Back