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

Yancedolly Bands - how to catch chickens ? - strategy part 1 for Amibroker (AFL)

Rating:
2 / 5 (Votes 4)
Tags:
amibroker, support, resistance

Have a nice day… :D

Screenshots

Similar Indicators / Formulas

Intraday Trades
Submitted by vishalsbharati about 13 years ago
Support & Resistance
Submitted by shyam242 almost 14 years ago
Support/Resistance Modified
Submitted by dkeleher about 14 years ago
Automatic Support and Resistance with Channel
Submitted by kaiji about 15 years ago
Tom DeMark Trend Lines
Submitted by kaiji about 15 years ago
Support and resistance range
Submitted by mediaworks about 14 years ago

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
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
_SECTION_BEGIN("Background Color");
BKswitch = ParamToggle("Background Color","On,Off");
  
OUTcolor =colorBlack;// ParamColor("Outer Panel Color",colorBlack);
INUPcolor =colorBlack;// ParamColor("Inner Panel Upper",colorBlack);
INDNcolor =colorBlack;// ParamColor("Inner Panel Lower",colorBlack);
TitleColor =colorBlack;// ParamColor("Title Color ",colorBlack);
  
if (NOT BKswitch)
{
SetChartBkColor(OUTcolor); // color of outer border
SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
}
_SECTION_END();
 
_SECTION_BEGIN("Parameter Color");
Line1=17;//ParamColor("Line Yancedolly Bands Medium Cycle Color",17);
Line2=6;//ParamColor("Line Yancedolly Bands Short Cycle Color",6);
Line3=9;//ParamColor("Line Floor Top Color",9);
Vol1=colorDarkGreen;//ParamColor("Vol Up Color",colorDarkGreen);
Vol2=colorDarkRed;//ParamColor("Vol Down Color",colorDarkRed);
Vol3=23;//ParamColor("Vol Avarage Color",23);
price1=colorRose;//ParamColor("Price Color",colorRose);
price2=colorBrightGreen;//ParamColor("Price Down Color",colorBrightGreen);
price3=colorRed;//ParamColor("Price Up Color",colorRed);
_SECTION_END();
 
_SECTION_BEGIN("Volume");
if (NOT ParamToggle("Volume Switch","On,Off"))
{
Plot( Volume, _DEFAULT_NAME(), IIf( C > O, Vol1, Vol2), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram  ), 2 );
Plot(MA(Volume,Param("MA Periods",5,5,50,1)),"",Vol3,styleLine |styleOwnScale ,Param("Scale",5,1,20,1));
}
_SECTION_END();
 
_SECTION_BEGIN("Yancedolly Bands");
 
hcl=(O+H+L+C)/4;
Ho=AMA(Ref(hcl,-1),0.5);
HH=Max(H,Max(hcl,Ho));
HL=Min(L,Min(hcl,Ho));
 
//trader = (hcl-Ho);
trader = (hcl);
VarRedLine = WMA(trader,5);
VarBlueLine = MA(trader,8);
Per =15;// Param("MA Periods",15,3,50,1);
//Plot(trader,"trader",colorDarkRed);
thick=0.5;//Param("thickness",0.5,0.01,5,0.01);
  
//P = ParamField("Price field",-1);
HDCPeriods = per;
//Width = Param("Width", 2, 0, 10, 0.05 );
//Color = ParamColor("Color", colorCycle );
//Style = ParamStyle("Style");
bbbot = BBandBot( trader, HDCPeriods, 2 );
bbc=MA(trader,HDCPeriods);
bbtop = BBandTop( trader, HDCPeriods, 2 );
//Plot( bbtop, "bbtop" , Line3, 1 );
//Plot( bbc, "bbc" , Line3, 1 );
//Plot( bbbot, "bbbot" , Line3, 1 );
 
//----------------------------------------------------
 
 
//BBLength= Param("BBLength",10,2,30,2);
//StdDv= Param("Stdev",2,0.5,5,0.1);
//UpB=BBandTop(H,BBLength,StdDv);
//Mdb=MA(C, BBLength);
//DnB=BBandBot(L,BBLength,StdDv);
 
K1=5;// Param("EMA Periods?",5,3,50);
K2=10;// Param("ATR Periods?",10,2,50);
Mul=1;//Param("ATR Multiplier?",1,0.5,5,0.5);
Mi=EMA(C, K1);
Kel= ATR(K2)*Mul;
UB= Mi + Kel;
LB= Mi - Kel;
 
CY2 =80/2;//  Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M2 = 3;// Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
UpY=EMA(C, CY2)+M2*ATR(CY2);
MdY=EMA(C, CY2);
DnY=EMA(C, CY2)-M2*ATR(CY2);
 
 
UpperBand4 =EMA( C, CY2) + ( 6.8540 * ATR(CY2));
UpperBand3 =EMA( C, CY2) + ( 4.2360 * ATR(CY2));
UpperBand2=EMA( C, CY2) +  ( 2.6180 * ATR(CY2));
UpperBand1=EMA( C, CY2) +  ( 1.6180 * ATR(CY2));
  
MidPoint=EMA(C, CY2);
  
LowerBand1=EMA( C, CY2) - ( 1.6180 * ATR(CY2));
LowerBand2=EMA( C, CY2) - ( 2.6180 * ATR(CY2));
LowerBand3=EMA( C, CY2) - ( 4.2360 * ATR(CY2));
LowerBand4=EMA( C, CY2) - ( 6.8540 * ATR(CY2));
 
if (NOT ParamToggle("Yancedolly Bands Info","On,Off"))
{
Plot( bbtop, "bbtop" , Line3, 1 );
Plot( bbc, "bbc" , Line3, 1 );
Plot( bbbot, "bbbot" , Line3, 1 );
Plot(UpperBand4,"UpperBand4",colorDarkTeal,1);
Plot(UpperBand3,"UpperBand3",colorDarkGrey,1);
Plot(UpperBand2,"UpperBand2",colorDarkRed,1);
Plot(UpperBand1,"UpperBand1",colorViolet,1);
Plot(MidPoint,"MidPoint",colorDarkGreen,4);
Plot(LowerBand1,"LowerBand1",colorViolet,1);
Plot(LowerBand2,"LowerBand2",colorDarkRed,1);
Plot(LowerBand3,"LowerBand3",colorDarkGrey,1);
Plot(LowerBand4,"LowerBand4",colorDarkTeal,1);
Plot (UB,"UB",Line2,1);
Plot (LB,"LB",Line2,1);
}else
{
Plot( bbtop, "" , Line3, 1 );
Plot( bbc, "" , Line3, 1 );
Plot( bbbot, "" , Line3, 1 );
Plot(UpperBand4,"",colorDarkTeal,1);
Plot(UpperBand3,"",colorDarkGrey,1);
Plot(UpperBand2,"",colorDarkRed,1);
Plot(UpperBand1,"",colorViolet,1);
Plot(MidPoint,"",colorDarkGreen,4);
Plot(LowerBand1,"",colorViolet,1);
Plot(LowerBand2,"",colorDarkRed,1);
Plot(LowerBand3,"",colorDarkGrey,1);
Plot(LowerBand4,"",colorDarkTeal,1);
Plot (UB,"",Line2,1);
Plot (LB,"",Line2,1);
}
//Plot (Close, "close",1,64);
//Plot (Mi,"",Line2,1);
//Plot (UB,"UB",Line2,1);
//Plot (LB,"LB",Line2,1);
//Plot(UpB,"",2,1);
//Plot(MdB,"",2,1);
//Plot(DnB,"",2,1);
//Plot(UpY,"UpY",Line1,1);
//Plot(MdY,"MdY",Line1,1);
//Plot(DnY,"DnY",Line1,1);
 
_SECTION_END();
 
 
_SECTION_BEGIN( "Price" );
GraphXSpace = 5;
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", IIf(L<=LB,price2,IIf(H>=UB,price3,price1)), styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
  
if ( ParamToggle( "Tooltip shows", "All Values|Only Prices" ) )
{
    ToolTip = StrFormat( "Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: " + NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
}
_SECTION_END();
 
_SECTION_BEGIN("Smooth CCI 14-7");
///// Smooth CCI //////
x=14;
Y=7;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_14_7 = Cross(x1,Y2);
Sell_14_7 = Cross(Y2,x1);
Buy_14_7=ExRem(Buy_14_7,Sell_14_7); Sell_14_7=ExRem(Sell_14_7,Buy_14_7);
//====================================================================================================================================
_SECTION_END();
 
_SECTION_BEGIN("Smooth CCI 12-6");
///// Smooth CCI //////
x=12;
Y=6;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_12_6 = Cross(x1,Y2);
Sell_12_6 = Cross(Y2,x1);
Buy_12_6=ExRem(Buy_12_6,Sell_12_6); Sell_12_6=ExRem(Sell_12_6,Buy_12_6);
//====================================================================================================================================
_SECTION_END();
 
_SECTION_BEGIN("Smooth CCI 10-5");
///// Smooth CCI //////
x=10;
Y=5;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_10_5 = Cross(x1,Y2);
Sell_10_5 = Cross(Y2,x1);
Buy_10_5=ExRem(Buy_10_5,Sell_10_5); Sell_10_5=ExRem(Sell_10_5,Buy_10_5);
//====================================================================================================================================
_SECTION_END();
 
_SECTION_BEGIN("Smooth CCI 8-4");
///// Smooth CCI //////
x=8;
Y=4;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_8_4 = Cross(x1,Y2);
Sell_8_4 = Cross(Y2,x1);
Buy_8_4=ExRem(Buy_8_4,Sell_8_4); Sell_8_4=ExRem(Sell_8_4,Buy_8_4);
//====================================================================================================================================
_SECTION_END();
 
_SECTION_BEGIN("ATR Trading System");
  k=1; /* multiplication factor*/
  n=10; /*period*/
  f=ATR(n);
      
  
    R[0] = Close[0];
  
    S[0] = C[0];
for( i = 11; i < BarCount; i++ )
{
  
  
   R[i]=R[i-1];
   S[i]=S[i-1];
  
    if ( C[i-1] >R[i-1] )
{
       r[i] = C[i-1]+k*f[i-1];
       s[i]= C[i-1]-k*f[i-1];
    if ( C[i-1] <S[i-1] )
{
       r[i] = C[i-1]+k*f[i-1];
       s[i]= C[i-1]-k*f[i-1];
}
  
  
//Buy=Close>R;
//Sell=Close<S;
 
Cump=IIf(Close>R,1,0);
Vanz=IIf(Close<S,1,0);
}
_SECTION_END();
 
_SECTION_BEGIN("Yancedolly Bands All in One");
if (ParamToggle("Smooth CCI Switch","On,Off"))
{
PlotShapes( Buy_14_7 * shapeUpArrow, colorGreen,0, L, -10);
PlotShapes( Sell_14_7 * shapeDownArrow, colorGreen,0, H, -10);
PlotShapes( Buy_12_6 * shapeUpArrow, colorViolet,0, L, -15);
PlotShapes( Sell_12_6 * shapeDownArrow, colorViolet,0, H, -15);
PlotShapes( Buy_10_5 * shapeUpArrow, colorRed,0, L, -20);
PlotShapes( Sell_10_5 * shapeDownArrow, colorRed,0, H, -20);
PlotShapes( Buy_8_4 * shapeUpArrow, colorTeal,0, L, -25);
PlotShapes( Sell_8_4 * shapeDownArrow, colorTeal,0, H, -25);
}
if (ParamToggle("ATR Trading System Switch","On,Off"))
{
PlotShapes( IIf(Cump, shapeSmallCircle,shapeNone), 5,0, L, -15);
PlotShapes(IIf( Vanz,shapeSmallCircle,shapeNone), 11,0, H, 15);
}
Filter = Buy_14_7 OR Sell_14_7 OR Buy_12_6 OR Sell_12_6 OR Buy_10_5 OR Sell_10_5 OR Buy_8_4 OR Sell_8_4;
//Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
AddTextColumn(FullName(),"Name");
AddColumn( Buy_14_7, "BUY_14_7",1.0,colorDefault,IIf(Buy_14_7,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_14_7, "SELL_14_7",1.0,colorDefault,IIf(Sell_14_7,colorRed,colorDefault),colorDefault);
AddColumn( Buy_12_6, "BUY_12_6",1.0,colorDefault,IIf(Buy_12_6,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_12_6, "SELL_12_6",1.0,colorDefault,IIf(Sell_12_6,colorRed,colorDefault),colorDefault);
AddColumn( Buy_10_5, "BUY_10_5",1.0,colorDefault,IIf(Buy_10_5,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_10_5, "SELL_10_5",1.0,colorDefault,IIf(Sell_10_5,colorRed,colorDefault),colorDefault);
AddColumn( Buy_8_4, "BUY_8_4",1.0,colorDefault,IIf(Buy_8_4,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_8_4, "SELL_8_4",1.0,colorDefault,IIf(Sell_8_4,colorRed,colorDefault),colorDefault);
_SECTION_END();

2 comments

1. ankit dargan

hi Yancedolly,

few highlights on ur afl

1 first part
hcl=(O+H+L+C)/4;
Ho=AMA,0.5);
HH=Max(H,Max(hcl,Ho));
HL=Min(L,Min(hcl,Ho));

//trader = (hcl-Ho);
trader = (hcl);
VarRedLine = WMA;
VarBlueLine = MA;
Per =15;// Param(“MA Periods”,15,3,50,1);
//Plot(trader,“trader”,colorDarkRed);
thick=0.5;//Param(“thickness”,0.5,0.01,5,0.01);

this part belongs to hidiffco n please change ur code from
trader = (hcl);
to
trader = (hcl-Ho);
to see actual hidiffco indicator use

2 ur afl consist of two ketner bands
1st
K1=5;// Param(“EMA Periods?”,5,3,50);
K2=10;// Param(“ATR Periods?”,10,2,50);
Mul=1;//Param(“ATR Multiplier?”,1,0.5,5,0.5);
Mi=EMA;
Kel= ATR*Mul;
UB= Mi + Kel;
LB= Mi – Kel;
2nd

CY2 =80/2;// Param(“Medium Cycle Length?” ,80, 1 ,1000 ,1 )/2;
M2 = 3;// Param(“Medium Cycle Multiplyer?” ,3, 0.01 ,10 ,1 );
UpY=EMA+M2*ATR(CY2);
MdY=EMA;
DnY=EMA-M2*ATR(CY2);

UpperBand4 =EMA + ( 6.8540 * ATR);
UpperBand3 =EMA + ( 4.2360 * ATR);
UpperBand2=EMA + ( 2.6180 * ATR);
UpperBand1=EMA + ( 1.6180 * ATR);

MidPoint=EMA;

LowerBand1=EMA – ( 1.6180 * ATR);
LowerBand2=EMA – ( 2.6180 * ATR);
LowerBand3=EMA – ( 4.2360 * ATR);
LowerBand4=EMA – ( 6.8540 * ATR);

plz try to optimize parameters of ketner bands as to get full benefits of it

thank you
ankit dargan

2. yancedolly

thank you Ankit Dargan..

Leave Comment

Please login here to leave a comment.

Back