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

Double Weighted Moving Average for Amibroker (AFL)
brsubra
almost 5 years ago
Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
moving average, amibroker

This is Double Weighted Moving Average (DWMA), like DEMA

DWMA can be used for Hull Moving Average Cross Over Strategies, like how Jurik is using DWMA for Cross Overs

Screenshots

Indicator / Formula

Copy & Paste Friendly

Apply to Price Chart

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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Chart Settings");
    
OUTcolor = ParamColor("Outer Panel Color",ColorRGB(25, 25, 25));
IINUPcolor = ParamColor("Inner Panel Upper",ColorRGB(45, 45, 45)); 
INDNcolor = ParamColor("Inner Panel Lower",ColorRGB(45, 45, 45));
TitleColor = ParamColor("Title Color ",ColorRGB(25, 25, 25));
 
SetChartOptions(0,chartShowDates|chartShowArrows);
 
stn= Param("Digit Length",10,1,40,1);
td=1.2;//String Decimals
TickSz = 0.05;
 
GraphXSpace=10;
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Background Text");
 
C11=ParamColor("up panel",ColorRGB(25, 25, 25)); 
C12=ParamColor("dn panel",ColorRGB(25, 25, 25) );
C13=Param("fonts",20,10,50,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",8,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 );
GfxSelectFont("Verdana", 12, 500, False, False, 0);
GfxSetTextColor(ColorRGB(34, 34, 34));
GfxSetTextAlign( 6 );
 
pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp);
Vp3 = Vrg + 3*st;
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st;
Vn2 = Vrg -2*st;
 
x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);
  
GfxGradientRect( 1, 1, 2000, 60, ColorRGB(25, 25, 25), ColorRGB(25, 25, 25));GfxSetBkMode(0);
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Name, Date & Time");
 
GfxSelectFont( "Verdana", 16, 600, False );
GfxSetTextColor( colorRGB(251,251,0));
GfxTextOut( Name(), x+150, y+10);
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor(colorRGB(255,255,255));
GfxTextOut( Date(), x+400, y+10 );
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Time Left");
 
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
  
GfxSelectSolidBrush( ColorRGB(0,0,0));
GfxSelectPen( ColorRGB(0,0,0) , 3 );
if ( NewPeriod )
{
GfxSelectSolidBrush( ColorRGB(0,0,0));
GfxSelectPen( colorRGB(0,0,0), 3 );
}
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor( colorRGB(255, 119, 255) );
GfxTextOut( "Time Left:" +SecsToGo+"/" +NumToStr( TimeFrame, 1.0 ), x+650, y+10 );
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Current Market Price");
 
GfxSelectFont("Verdana", 18, 600, False  );
GfxSetTextColor( colorRGB(161, 202, 241));
GfxTextOut("LTP:" +WriteVal(C,td), x+1200,y+35 );
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("O,H,L,C,V");
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor( ColorRGB(255,255,255) );
GfxTextOut( "Open:"+WriteVal(O,td), x+850, y+10 );
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor( ColorRGB(0,255,0) );
GfxTextOut( "High:"+WriteVal(H,td), x+1050, y+10 );
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor( colorRGB(255, 69, 0) );
GfxTextOut( "Low:"+WriteVal(L,td), x+1250, y+10 );
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor( colorRGB(255,255,0) );
GfxTextOut( "Close:"+WriteVal(C,td), x+1450, y+10 );
 
td1 = 1.0; //String Decimals
 
GfxSelectFont( "Verdana", 14, 600, False );
GfxSetTextColor( colorRGB(255, 119, 255) );
GfxTextOut( "Vol:"+WriteVal(V,td1, stn), x+1650, y+10 );
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Heiken Ashi");
 
HaClose[0] = (Open[0]+High[0]+Low[0]+Close[0]) / 4;
HaOpen[0]  = (HaClose[0] + Open[0]) / 2;
HaHigh[0]  = Max( High[0], Max( HaClose[0], HaOpen[0] ) );
HaLow[0]   = Min( Low[0], Min( HaClose[0], HaOpen[0] ) );
 
for (i=1; i<BarCount; i++)
    {
    HaClose[i] = (Open[i]+High[i]+Low[i]+Close[i]) / 4;
    Haopen[i]  = (HaClose[i-1] + HaOpen[i-1]) / 2; // Here is the problem when using Arrays: Haopen always uses its own previous value
    HaHigh[i]  = Max( High[i], Max( HaClose[i], HaOpen[i] ) );
    Halow[i]   = Min( Low[i], Min( HaClose[i], HaOpen[i] ) );
}
 
range = 3;
 
BarColor = IIf( PDI(range) > MDI(range), ColorRGB(222, 236, 255),ColorRGB(30, 144, 255));
 
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, " " , BarColor, styleCandle|styleNoLabel, Null, Null, 0, 0, 3);
  
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Price Line");
 
PriceLineColor=ColorRGB(161, 202, 241);
Barsback = 500;
FirstBar = BarCount - BarsBack;
YY = IIf(BarIndex() >= Firstbar,EndValue(C),Null);
 
Plot(YY,"Current Price",PriceLineColor, styleLine|styleNoLabel|styleThick, 2);
 
side = 1;
 
dist = 0;
 
for( i = 0; i < BarCount; i++ )
 
if(i+side== BarCount) PlotText( "\n " + C[ i ] ,  i, YY[ i ]-dist, ColorRGB(255, 8, 0));
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Double Weighted Moving Averages");
 
AP = (HaLow+HaHigh)/2;
 
 
// DWMA 9
 
function DWMA(price,periods)
{
 
e1=WMA(price,periods);
e2=WMA(e1,Periods);
 
DWMAi=2*e1-e2;
return DWMAi;
}
 
MA1 = DWMA(AP, 9);
 
Plot ( MA1, " ", ColorRGB(255, 0, 255) ,  styleNoLabel, Null, Null, 0 , 0, 2);
 
// HMA 13
 
MA2 = HMA(AP, 13);
 
Plot ( MA2, " ", ColorRGB(255, 255, 0) , styleNoLabel, Null, Null, 0 , 0, 2);
 
 
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Mood");
 
 
BKswitch = ParamToggle("Mood","On,Off");
  
OUTcolor = ParamColor("Outer Panel Color",ColorRGB(25, 25, 25));
INUPcolor = ParamColor("Inner Panel Upper",ColorRGB(45, 45, 45));
INDNcolor = ParamColor("Inner Panel Lower",ColorRGB(45, 45, 45));
TitleColor = ParamColor("Title Color ",ColorRGB(25, 25, 25));
if (NOT BKswitch)
{
SetChartBkColor(OUTcolor); // color of outer border
SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
}
 
_SECTION_END();
 
//////////////////////////////////////////////////////////////////

1 comments

1. Kenbk

Have some issue.

PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, " " , BarColor, styleCandle|styleNoLabel, Null, Null, 0, 0, 3);

Plot ( MA1, " ", ColorRGB(255, 0, 255) ,  styleNoLabel, Null, Null, 0 , 0, 2); 

Plot ( MA2, " ", ColorRGB(255, 255, 0) , styleNoLabel, Null, Null, 0 , 0, 2);

Leave Comment

Please login here to leave a comment.

Back