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

Fix Kenzie SR System for Amibroker (AFL)

Rating:
4 / 5 (Votes 13)
Tags:
trading system, amibroker, bands

modified the formula from http://www.wisestocktrader.com/indicators/2238-kenzie-sr-system

- fixed the OHLC price not showing issue
- added to plot buy/sell price along with signals.
- add filter to scan high volumn stock only.
- change color of fonts so that they can be read easily with while background.
- tested with Amibroker 5.4

Screenshots

Similar Indicators / Formulas

Extreme Keltner using ATR
Submitted by jenkisan about 13 years ago
Heikin Ashi HaDiffCO
Submitted by kaiji over 15 years ago
Candle alert based on 200 EMA
Submitted by JPMamgain almost 13 years ago
Bollinger Trading system
Submitted by anandnst over 12 years ago
Bollinger band using STD Dev and MA
Submitted by surindersingh over 13 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
//--------------------------------------------------------------//
//  Kenzie SR System - 09/2010
//  Modified By Kenzie Sebastian (kenziesr@yahoo.co.id)
//  Shared for milis amibroker-4-bei@yahoogroups.com
//
// - fixed the OHLC price not showing issue.
// - added to plot buy/sell price along with signals.
// - add filter to scan high volumn stock only.
// - change color of fonts so that they can be read easily with //   while background.
//--------------------------------------------------------------
SetBarsRequired( 800, 0 );
 
GraphXSpace = 7;
SetChartOptions( 0, chartShowArrows | chartShowDates );
 
// set criteria to scan for big stock only;
BigStock = MA( V, 10 ) * MA( C, 10 ) > 1000000;
 
//---------------Color------------------------
per1 = 6;
per2 = 2;
Om = MA( O, per1 );
hm = MA( H, per1 );
lm = MA( L, per1 );
Cm = MA( C, per1 );
 
// 1. Heiken Ashi
HACLOSE = ( Om + Hm + Lm + Cm ) / 4;
HaOpen = AMA( Ref( HaClose,  -1 ),  0.5 );
HaHigh = Max( Hm,  Max( HaClose,  HaOpen ) );
HaLow = Min( Lm,  Min( HaClose,  HaOpen ) );
 
 
Of = MA( Haopen, per2 );
Cf = MA( Haclose, per2 );
Lf = IIf( haOpen < haClose, MA( Halow, per2 ), MA( Hahigh, per2 ) );
Hf = IIf( haOpen < haClose, MA( Hahigh, per2 ), MA( Halow, per2 ) );
//Color = IIf( Cf > Of, colorGreen, colorRed );
 
 
//----------------------------------------------------
 
TrailStop = HHV( C - 2 * ATR( 10 ), 15 );
ProfitTaker = EMA( H, 13 ) + 2 * ATR( 10 );
 
/* **********************************
Code to automatically identify pivots
********************************** */
 
// -- what will be our lookback range for the hh and ll?
farback = 140; //How Far back to go
nBars = 12; //Number of bars
 
// -- Create 0-initialized arrays the size of barcount
aHPivs = H - H;
aLPivs = L - L;
 
// -- More for future use, not necessary for basic plotting
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
 
// -- looking back from the current bar, how many bars
// back were the hhv and llv values of the previous
// n bars, etc.?
aHHVBars = HHVBars( H, nBars );
aLLVBars = LLVBars( L, nBars );
aHHV = HHV( H, nBars );
aLLV = LLV( L, nBars );
 
// -- Would like to set this up so pivots are calculated back from
// last visible bar to make it easy to "go back" and see the pivots
// this code would find. However, the first instance of
// _Trace output will show a value of 0
aVisBars = Status( "barvisible" );
nLastVisBar = LastValue( Highest( IIf( aVisBars, BarIndex(), 0 ) ) );
_TRACE( "Last visible bar: " + nLastVisBar );
 
// -- Initialize value of curTrend
curBar = ( BarCount - 1 );
curTrend = "";
 
if ( aLLVBars[curBar] < aHHVBars[curBar] )
{
    curTrend = "D";
}
else
{
    curTrend = "U";
}
 
// -- Loop through bars. Search for
// entirely array-based approach
// in future version
for ( i = 0; i < BarCount; i++ )
{
    curBar = ( BarCount - 1 ) - i;
// -- Have we identified a pivot? If trend is down...
 
    if ( aLLVBars[curBar] < aHHVBars[curBar] )
    {
// ... and had been up, this is a trend change
        if ( curTrend == "U" )
        {
            curTrend = "D";
// -- Capture pivot information
            curPivBarIdx = curBar - aLLVBars[curBar];
            aLPivs[curPivBarIdx] = 1;
            aLPivLows[nLPivs] = L[curPivBarIdx];
            aLPivIdxs[nLPivs] = curPivBarIdx;
            nLPivs++;
        }
 
// -- or current trend is up
    }
    else
    {
        if ( curTrend == "D" )
        {
            curTrend = "U";
            curPivBarIdx = curBar - aHHVBars[curBar];
            aHPivs[curPivBarIdx] = 1;
            aHPivHighs[nHPivs] = H[curPivBarIdx];
            aHPivIdxs[nHPivs] = curPivBarIdx;
            nHPivs++;
        }
 
// -- If curTrend is up...else...
    }
 
// -- loop through bars
}
 
// -- Basic attempt to add a pivot this logic may have missed
// -- OK, now I want to look at last two pivots. If the most
// recent low pivot is after the last high, I could
// still have a high pivot that I didn't catch
// -- Start at last bar
curBar = ( BarCount - 1 );
 
candIdx = 0;
 
candPrc = 0;
 
lastLPIdx = aLPivIdxs[0];
 
lastLPL = aLPivLows[0];
 
lastHPIdx = aHPivIdxs[0];
 
lastHPH = aHPivHighs[0];
 
if ( lastLPIdx > lastHPIdx )
{
// -- Bar and price info for candidate pivot
    candIdx = curBar - aHHVBars[curBar];
    candPrc = aHHV[curBar];
 
    if (
        lastHPH < candPrc AND
        candIdx > lastLPIdx AND
        candIdx < curBar )
    {
// -- OK, we'll add this as a pivot...
        aHPivs[candIdx] = 1;
// ...and then rearrange elements in the
// pivot information arrays
 
        for ( j = 0; j < nHPivs; j++ )
        {
            aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs- ( j+1 )];
            aHPivIdxs[nHPivs-j] = aHPivIdxs[nHPivs-( j+1 )];
        }
 
        aHPivHighs[0] = candPrc ;
 
        aHPivIdxs[0] = candIdx;
        nHPivs++;
    }
}
else
{
// -- Bar and price info for candidate pivot
    candIdx = curBar - aLLVBars[curBar];
    candPrc = aLLV[curBar];
 
    if (
        lastLPL > candPrc AND
        candIdx > lastHPIdx AND
        candIdx < curBar )
    {
// -- OK, we'll add this as a pivot...
        aLPivs[candIdx] = 1;
// ...and then rearrange elements in the
// pivot information arrays
 
        for ( j = 0; j < nLPivs; j++ )
        {
            aLPivLows[nLPivs-j] = aLPivLows[nLPivs-( j+1 )];
            aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-( j+1 )];
        }
 
        aLPivLows[0] = candPrc;
 
        aLPivIdxs[0] = candIdx;
        nLPivs++;
    }
}
 
//============== EXPLORATION ==============
Buy = Cover = BigStock AND aLPivs == 1;
 
Sell = Short = BigStock AND aHPivs == 1;
 
SellPrice = ValueWhen( Sell, C, 1 );
 
BuyPrice = ValueWhen( Buy, C, 1 );
 
Long = Flip( Buy, Sell );
 
Shrt = Flip( Sell, Buy );
 
//============== Plot price ==============
n = 15;
 
a =  C > ( MA( H, n ) + MA( L, n ) ) / 2;// then Buy next bar at market;
 
b = C < ( MA( H, n ) + MA( L, n ) ) / 2;// then Sell Short next bar at market;
 
state = IIf( BarsSince( a ) < BarsSince( b ), 1, 0 );
 
Longs = state == 1;
 
shorts = state == 0;
 
//Chart
Colorbar = IIf( Longs, colorGreen, IIf( Shorts, colorRed, colorGrey40 ) );
 
Plot( C, "Close", colorbar, styleCandle = 64 | styleNoTitle );
 
//============== Plot Shape ==============
PlotShapes( IIf( aHPivs == 1, shapeDownArrow, shapeNone ), colorOrange, 0, High, Offset = -12 );
 
PlotShapes( IIf( aLPivs == 1, shapeUpArrow , shapeNone ), colorLime, 0, Low, Offset = -12 );
PlotShapes( IIf(Buy, shapeSmallCircle, shapeNone),colorBrightGreen, 0, BuyPrice, 0 );
PlotShapes( IIf(Sell, shapeSmallCircle, shapeNone),colorRed, 0 ,SellPrice, 0 );
FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status("LastVisibleBar");
for( b = Firstvisiblebar; b <= Lastvisiblebar AND b < BarCount; b++)
{
if( Buy[b] ) PlotText("\n Buy\n "+NumToStr(BuyPrice[b],1.2),b,BuyPrice[b],colorBrightGreen);
else if( Sell[b] ) PlotText("\n Sell\n "+NumToStr(SellPrice[b],1.2),b,SellPrice[b],colorRed);
}
 
//============== EMA(13) ==============
Plot( EMA( C, 13 ), "", colorBlue, styleLine + styleNoRescale );
 
//============== TRENDING ==============
DTL = 150; // DTL = Define Trend Long
 
DTM = 70;   // DTM = Define Trend Medium
 
DTS = 14;  // DTS = Define Trend Short
 
TL = LinRegSlope( MA( C, DTL ), 2 );     // TL = Trend Long
 
TM = LinRegSlope( MA( C, DTM ), 2 );  // TM = Trend Medium
 
TS = LinRegSlope( MA( C, DTS ), 2 );  // TS = Trend Short
 
TLL = IIf( LinRegSlope( MA( C, DTL ), 2 ) > 0, True, False );
 
TMM = IIf( LinRegSlope( MA( C, DTM ), 2 ) > 0, True, False );
 
TSS = IIf( LinRegSlope( MA( C, DTS ), 2 ) > 0, True, False );
 
//============== VOLUME ==============
Vlp = 30; //Volume lookback period
 
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;
 
//============== WILLIAM'S %R ==============
WR = ( ( HHV( H, 14 ) - C ) / ( HHV ( H, 14 ) - LLV ( L, 14 ) ) ) * -100;
 
//============== A/D ==============
TRH = IIf( Ref( C, -1 ) > H, Ref( C, -1 ), H );
 
TRL = IIf( Ref( C, -1 ) < L, Ref( C, -1 ), L );
 
ad = IIf( C > Ref( C, -1 ), C - TRL, IIf( C < Ref( C, -1 ), C - TRH, 0 ) );
 
WAD = Cum( ad );
 
wu = wad > Ref( wad, -1 );
 
wd = wad < Ref( wad, -1 );
 
//============== MACD ==============
MB = Cross ( MACD(), Signal() );
 
MS = Cross( Signal(), MACD() );
 
MB = ExRem( MB, MS );
 
MS = ExRem( MS, MB );
 
MB1 = MACD() > Signal();
 
MS1 = MACD() < Signal();
 
//============== STOCH ==============
StochKval = StochK( 10, 5 );
 
StochDval = StochD( 10, 5, 5 );
 
StochBuy = Cross( StochK( 10, 5 ), StochD( 10, 5, 5 ) );
 
StochSell = Cross ( StochD( 10, 5, 5 ), StochK( 10, 5 ) );
 
StBuy = StochK( 10, 5 ) > StochD( 10, 5, 5 );
 
StSell = StochK( 10, 5 ) < StochD( 10, 5, 5 );
 
//============== ADX ==============
adxBuy =  Cross( PDI( 14 ), MDI( 14 ) );
 
adxSell = Cross( MDI( 14 ), PDI( 14 ) );
 
adxBuy = ExRem( adxBuy, adxSell );
 
adxSell = ExRem( adxSell, adxBuy );
 
adxbuy1 = PDI( 14 ) > MDI( 14 );
 
adxsell1 = MDI( 14 ) > PDI( 14 );
 
//============== TMA ==============
function ZeroLagTEMA( array, period )
{
    TMA1 = TEMA( array, period );
    TMA2 = TEMA( TMA1, period );
    Diff = TMA1 - TMA2;
    return TMA1 + Diff ;
}
 
haClose = ( haClose + haOpen + haHigh + haLow ) / 4;
 
periodtm = 55;
ZLHa = ZeroLagTEMA( haClose, periodtm );
ZLTyp = ZeroLagTEMA( Avg, periodtm );
TMBuy = Cross( ZLTyp, ZLHa );
TMSell = Cross( ZLHa, ZLTyp );
TMBuy1 = ZLTyp > ZLHa ;
TMSell1 = ZLHa > ZLTyp ;
 
//============== ZLW ==============
R = ( ( HHV( H, 14 ) - C ) / ( HHV ( H, 14 ) - LLV ( L, 14 ) ) ) * -100;
MaxGraph = 10;
PeriodZ = 10;
EMA1 = EMA( R, PeriodZ );
EMA2 = EMA( EMA1, 5 );
Difference = EMA1 - EMA2;
ZeroLagEMA = EMA1 + Difference;
PR = 100 - abs( ZeroLagEMA );
MoveAvg = MA( PR, 5 );
ZBuy = Cross( PR, moveAvg ) AND PR < 30;
ZSell = Cross( moveAvg, PR ) AND PR > 70;
ZBuy1 = PR >= MoveAvg AND PR >= Ref( PR, -1 ) ;
ZSell1 = ( PR < MoveAvg ) OR PR >= MoveAvg AND PR < Ref( PR, -1 ) ;
 
//============== RS ==============
p = ( H + L + C ) / 3;
r1 = ( 2 * p ) - L;
s1 = ( 2 * p ) - H;
r2 = p + ( r1 - s1 );
s2 = p - ( r2 - s1 );
R3 = P + ( R2 - S2 );
S3 = P - ( R3 - S2 );
 
//============== IBUY ==============
Ibuy =  Cross( RSI( 14 ), EMA( RSI( 14 ), 9 ) );
Isell = Cross( EMA( RSI( 14 ), 9 ), RSI( 14 ) );
Ibuy = ExRem( Ibuy, ISell );
Isell = ExRem( ISell, Ibuy );
BlRSI = RSI( 14 ) > EMA( RSI( 14 ), 9 );
BrRSI = RSI( 14 ) < EMA( RSI( 14 ), 9 );
 
 
//============== TITLE ==============
_SECTION_BEGIN( "Title" );
printf( "Open : " + O );
 
if ( Status( "action" ) == actionIndicator )
    (
        Title = EncodeColor( colorBlack ) + "Kenzie SR System" + EncodeColor( colorBlack ) + " (" Name() + ") " + EncodeColor( colorBlack ) + Interval( 2 ) +
                "  " + Date() + " " + " ? Open " + O + "  ? " + "Hi " H + "  ? " + "Lo " + L + "  ? " +
                "Close " + C + " (" + WriteVal( C - Ref( C, -1 ), 1, 0 ) + " " + WriteVal( ( C - Ref( C, -1 ) ) * 100 / Ref( C, -1 ), 1.1 ) + "%)  ? Vol= " + WriteVal( V, 1.0 )
                + " " + WriteIf( V > Vp2, EncodeColor( colorLime ) + "(Very High)", WriteIf( V > Vp1, EncodeColor( colorLime ) + "(High)", WriteIf( V > Vrg, EncodeColor( colorLime ) + "(Above Average)",
                                 WriteIf( V<Vrg AND V>Vn1, EncodeColor( ColorRGB( 255, 0, 128 ) ) + "(Less than Average)", WriteIf( V < Vn1, "(Low)", "" ) ) ) ) ) + EncodeColor( colorGrey50 ) + "  ? "
                + EncodeColor( colorLime ) + "EMA(Close,13) = " + WriteVal( EMA( C, 13 ), 1.2 )
 
                + "\n" + EncodeColor( colorGrey50 ) + "--------------------------------------"
 
                + "\n" + EncodeColor( colorBlack ) +
                WriteIf ( Buy , "Signal: Go Long - Entry Price: " + WriteVal( C, 1.2 ) + " - Last Exit Price: " + WriteVal( SellPrice, 1.2 )
                          + " (" + WriteVal( ( BuyPrice - SellPrice ), 1.2 ) + ") - StopLoss: " + WriteVal( C * .95, 1.2 ) + " - Reward Risk Ratio: " + WriteVal( ( profittaker - C ) / ( C - C * 0.95 ), 1.2 ) + " - " + EncodeColor( colorLime ) + "Strong Buy!"
                          , "" ) +
 
 
                WriteIf ( Sell , "Signal: Go Short - Exit Price: " + WriteVal( C, 1.2 ) + " - Profit: " + WriteVal( ( SellPrice - BuyPrice ), 1.2 ) + " (" + WriteVal( ( ( SellPrice - BuyPrice ) * 100 / BuyPrice ), 1.1 ) + "%)" + " - Profit Taking!", "" ) +
                EncodeColor( ColorRGB( 111, 208, 255 ) ) +
                WriteIf( Long AND NOT Buy, "Trade: Long - Entry Price: " + WriteVal( ( BuyPrice ), 1.2 ) + " - Profit: " + WriteVal( ( C - BuyPrice ), 1.2 ) + " (" + WriteVal( ( ( C - BuyPrice ) * 100 / BuyPrice ), 1.1 ) + "%)" +
                         " - StopLoss:" + WriteVal( ( BuyPrice * .95 ), 1.2 ) + " - Reward Risk Ratio: " + WriteVal( ( profittaker - BuyPrice ) / ( BuyPrice - BuyPrice * 0.95 ), 1.2 ) + " - " + EncodeColor( colorLime ) + "Let your profit runs!", "" ) +
                WriteIf( shrt AND NOT Sell, "Trade: Short - Exit Price: " + WriteVal( ( SellPrice ), 1.2 ) + " - Profit: " + WriteVal( ( SellPrice - BuyPrice ), 1.2 ) + " (" + WriteVal( ( ( SellPrice - BuyPrice ) * 100 / BuyPrice ), 1.1 ) + "%) - " + EncodeColor( colorLime ) + "Watch for Strong Buy Signal!", "" )
 
                + "\n" + EncodeColor( colorGrey50 ) + "--------------------------------------"
 
                + "\n" + EncodeColor( colorBlack ) + "?Short Term: " +
                WriteIf( TS > 0 AND TS < 0.3, EncodeColor( colorLime ) + "Weak Up Trend",
                         WriteIf( TS >= 0.3 AND TS < 0.6 , EncodeColor( colorBlack ) + "Medium Up Trend",
                                  WriteIf( TS >= 0.6, EncodeColor( colorGreen ) + "Strong Up Trend",
                                           WriteIf( TS<0 AND TS> -0.3, EncodeColor( colorPink ) + "Weak Down Trend",
                                                    WriteIf( TS <= -0.3 AND TS > -0.6 , EncodeColor( ColorRGB( 255, 0, 128 ) ) + "Medium Down Trend",
                                                             WriteIf( TS <= -0.6, EncodeColor( colorRed ) + "Strong Down Trend", EncodeColor( colorGrey50 ) + "Sideways" ) ) ) ) ) )
 
                + "\n" + EncodeColor( colorBlack ) + "?Mid Term: " +
                WriteIf( TM > 0 AND TM < 0.3, EncodeColor( colorLime ) + "Weak Up Trend",
                         WriteIf( TM >= 0.3 AND TM < 0.6 , EncodeColor( colorBlack ) + "Medium Up Trend",
                                  WriteIf( TM >= 0.6, EncodeColor( colorGreen ) + "Strong Up Trend",
                                           WriteIf( TM<0 AND TM> -0.3, EncodeColor( colorPink ) + "Weak Down Trend",
                                                    WriteIf( TM <= -0.3 AND TM > -0.6 , EncodeColor( ColorRGB( 255, 0, 128 ) ) + "Medium Down Trend",
                                                             WriteIf( TM <= -0.6, EncodeColor( colorRed ) + "Strong Down Trend", EncodeColor( colorGrey50 ) + "Sideways" ) ) ) ) ) )
 
                + "\n" + EncodeColor( colorBlack ) + "?Long Term: " +
                WriteIf( TL > 0 AND TL < 0.3, EncodeColor( colorLime ) + "Weak Up Trend",
                         WriteIf( TL >= 0.3 AND TL < 0.6 , EncodeColor( colorBlack ) + "Medium Up Trend",
                                  WriteIf( TL >= 0.6, EncodeColor( colorGreen ) + "Strong Up Trend",
                                           WriteIf( TL<0 AND TL> -0.3, EncodeColor( colorPink ) + "Weak Down Trend",
                                                    WriteIf( TL <= -0.3 AND TL > -0.6 , EncodeColor( ColorRGB( 255, 0, 128 ) ) + "Medium Down Trend",
                                                             WriteIf( TL <= -0.6, EncodeColor( colorRed ) + "Strong Down Trend", EncodeColor( colorGrey50 ) + "Sideways" ) ) ) ) ) )
 
                + "\n" + EncodeColor( colorGrey50 ) + "--------------------------------------"
 
                + "\n" + EncodeColor( 47 ) + "?AccDist(): " + WriteIf( wu, EncodeColor( colorBlack ) + "Accumulation", WriteIf( wd, EncodeColor( colorRed ) + "Distribution", "Neutral" ) )
 
                + "\n" + EncodeColor( 47 ) + "?RSI(14): " + WriteIf( RSI( 14 ) > 30 AND RSI( 14 ) < 70, EncodeColor( colorBlack ), WriteIf( RSI( 14 ) < 30 , EncodeColor( colorBlue ), EncodeColor( colorRed ) ) ) + WriteVal( RSI( 14 ), format = 1.1 )
                + WriteIf( RSI( 14 ) > 30 AND RSI( 14 ) < 70, " Range" + EncodeColor( colorBlack ), WriteIf( RSI( 14 ) < 30 , " OverSold" + EncodeColor( colorBlue ), " OverBought" + EncodeColor( colorRed ) ) )
 
                + "\n" + EncodeColor( 47 ) + "?CCI(14): " + WriteIf( CCI( 14 ) > -100 AND CCI( 14 ) < 100, EncodeColor( colorBlack ), WriteIf( CCI( 14 ) < -100 , EncodeColor( colorBlue ), EncodeColor( colorRed ) ) ) + WriteVal( CCI( 14 ), format = 1.1 )
                + WriteIf( CCI( 14 ) > -100 AND CCI( 14 ) < 100, " Range" + EncodeColor( colorBlack ), WriteIf( CCI( 14 ) < -100 , " OverSold" + EncodeColor( colorBlue ), " OverBought" + EncodeColor( colorRed ) ) )
 
                + "\n" + EncodeColor( 47 ) + "?ROC(C,14): " + WriteIf( ROC( C, 14 ) > -10 AND ROC( C, 14 ) < 10, EncodeColor( colorBlack ), WriteIf( ROC( C, 14 ) < -10 , EncodeColor( colorBlue ), EncodeColor( colorRed ) ) ) + WriteVal( ROC( C, 14 ), format = 1.1 )
                + WriteIf( ROC( C, 14 ) > -10 AND ROC( C, 14 ) < 10, " Range" + EncodeColor( colorBlack ), WriteIf( ROC( C, 14 ) < -10 , " OverSold" + EncodeColor( colorBlue ), " OverBought" + EncodeColor( colorRed ) ) )
 
                + "\n" + EncodeColor( 47 ) + "?Wm%R(14): " + WriteIf( WR > -80 AND WR < -20, EncodeColor( colorBlack ), WriteIf( WR < -80 , EncodeColor( colorBlue ), EncodeColor( colorRed ) ) ) + WriteVal( WR, format = 1.1 )
                + WriteIf( WR > -80 AND WR < -20, " Range" + EncodeColor( colorBlack ), WriteIf( WR < -80 , " OverSold" + EncodeColor( colorBlue ), " OverBought" + EncodeColor( colorRed ) ) )
 
 
                + "\n" + EncodeColor( colorGrey50 ) + "--------------------------------------"
 
                + "\n" + EncodeColor( colorBlack ) + "?Signal(IBuy): " + WriteIf( Ibuy, EncodeColor( colorBlack ) + "BuyWarning", WriteIf( Isell, EncodeColor( colorRed ) + "SellWarning", WriteIf( BlRSI, EncodeColor( colorBlack ) + "BullishZone", WriteIf( BrRSI, EncodeColor( colorRed ) + "BearishZone", "Neutral" ) ) ) )
 
                + "\n" + EncodeColor( colorBlack ) + "?Signal(TMA): " + WriteIf( TMBuy, EncodeColor( colorBlack ) + "Buy", WriteIf( TMSell, EncodeColor( colorRed ) + "Sell", WriteIf( TMBuy1, EncodeColor( colorBlack ) + "Bullish", WriteIf( TMSell1, EncodeColor( colorRed ) + "Bearish", "Neutral" ) ) ) )
 
                + "\n" + EncodeColor( colorBlack ) + "?Signal(MACD): " + WriteIf( MB, EncodeColor( colorBlack ) + "Buy", WriteIf( MS, EncodeColor( colorRed ) + "Sell", WriteIf( MB1, EncodeColor( colorBlack ) + "Bullish", WriteIf( MS1, EncodeColor( colorRed ) + "Bearish", "Neutral" ) ) ) )
 
                + "\n" + EncodeColor( colorBlack ) + "?Signal(Stoch): " + WriteIf( StochBuy, EncodeColor( colorBlack ) + "Buy", WriteIf( StochSell, EncodeColor( colorRed ) + "Sell", WriteIf( StBuy, EncodeColor( colorBlack ) + "Bullish", WriteIf( StSell, EncodeColor( colorRed ) + "Bearish", "Neutral" ) ) ) )
 
                + "\n" + EncodeColor( colorBlack ) + "?Signal(ADX): " + WriteIf( adxBuy, EncodeColor( colorBlack ) + "Buy", WriteIf( adxSell, EncodeColor( colorRed ) + "Sell", WriteIf( adxBuy1, EncodeColor( colorBlack ) + "Bullish", WriteIf( adxSell1, EncodeColor( colorRed ) + "Bearish", "Neutral" ) ) ) )
 
                + "\n" + EncodeColor( colorGrey50 ) + "--------------------------------------"
 
                + "\n" + EncodeColor( 47 ) + "?TrStop: " + EncodeColor( colorLime ) + WriteVal( TrailStop, format = 1.0 )
                + EncodeColor( 47 ) + " TrgPrice: " + EncodeColor( colorLime ) + WriteVal( Profittaker, format = 1.0 )
                + "\n" + EncodeColor( 47 ) + "?R1: " + EncodeColor( colorOrange ) + WriteVal( r1, format = 1.0 )
                + EncodeColor( 47 ) + " R2: " + EncodeColor( colorOrange ) + WriteVal( r2, format = 1.0 )
                + EncodeColor( 47 ) + " R3: " + EncodeColor( colorOrange ) + WriteVal( r3, format = 1.0 )
                + "\n" + EncodeColor( 47 ) + "?S1: " + EncodeColor( colorOrange ) + WriteVal( s1, format = 1.0 )
                + EncodeColor( 47 ) + " S2: " + EncodeColor( colorOrange ) + WriteVal( s2, format = 1.0 )
                + EncodeColor( 47 ) + " S3: " + EncodeColor( colorOrange ) + WriteVal( s3, format = 1.0 )
 
                + "\n" + EncodeColor( colorGrey50 ) + "--------------------------------------"
 
    );
 
 
//============== BACKGROUND NAME ==============
 
pxwidth = Status( "pxwidth" );
 
pxheight = Status( "pxheight" );
 
GfxSetOverlayMode( 1 );
 
GfxSetBkMode( 0 ); // transparent
 
GfxSelectFont( "Amienne", Status( "pxheight" ) / 15 );
 
GfxSetTextColor( colorGrey40 );
 
//GfxTextOut( "Kenzie Sebastian", Status("pxwidth")/5.3, Status("pxheight")/5 );
 
//============================
 
////BACKGROUND COLOR////////////////////////////////////////////////////////
//SetChartBkColor(ColorRGB(255,200,255));
//SetChartBkGradientFill( colorPlum, colorPlum);
/////////////////////////////////////////////////////////////////////////////////////
 
 
 
_SECTION_END();
 
_SECTION_BEGIN( "Keltner Bands" );
 
P = ParamField( "Price field", -1 );
 
Periods = Param( "Periods", 15, 2, 300, 1 );
 
Width = Param( "Width", 2, 0, 10, 0.05 );
 
Color = ParamColor( "Color", colorCycle );
 
Style = ParamStyle( "Style" );
 
CenterLine = MA( P, Periods );
 
KTop   = CenterLine + Width * ATR( Periods );
 
KBot = CenterLine - Width * ATR( Periods );
 
Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style );
 
Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style );
_SECTION_END();

19 comments

1. Rolta

What u have use? but it is good formula. Are u trade on this formula?

2. target1cr

I will do back test and post the results. Thanks for posting.

3. mahesh.aranake

dear admin

seems to look into future – please confirm

4. administrator

Hi mahesh.aranake

Most pivot point formulas look into the future including this one.

5. kamalk1996

every buy and sell symbol,rates change time to time @ new high or low

6. Rakesh Kumar

Buy & Sell Signal are same. So what the modification. Even previous version fonts were more clear than this one.

7. matant

I think that this trading system look in the future and move the operation sygnal (buy/sell) also after that more bars are completed. Is it normal? How is it possible to fix? The right method to test it, is only with walk forward test? Is it right? What do you think?

8. jachyuen

it does look in the future. But it gives a good “heads up” on potential turning points for buy (sell on the other hand, usually comes in late :( ). So should be used as a “semi-auto” signal (i.e. look for other confirmations when a “buy” shows up, and rely on other like SwingN or KPL for sell). should have used more parameters in the formula too.

well. actually didn’t expect this many comments for an modified formula :P

9. matant

Ok, I appreciate very well your trading system and your observation.
Becuase you have specified two suggestion for the sell signal, what do you recommend for buy signal in liquid market as a index?

10. trinag

very good for intraday
thank you

11. varadan

Good System to trade for Intraday.

12. algotrader01

Can anyone please code a non repainting version of this code ? The buy & sell signals changes as price changes but otherwise its a good afl for short term trading

13. meceng1985

it’s simply useless..been following since 5 days, it wasn’t giving any strong buy but only “wait for strong buy” signal but now I check it and it says it was the strong buy 3 days ago..

14. cadoize

how to scan/explore with this AFL?

15. Atlasraketa

The system show signals to buy to sell on the last chart, not in advance.
it makes no sense.

16. acchiang

Error on row 247
Plot( C, “Close”, colorbar, styleCandle = 64 | styleNoTitle );

17. godisbogus

Post mortem afl.

18. Suman292007

It is absolutely fine for intraday except stoploss. for future stoploss is very high in anytimeframe whereas for option it is ok, can it be fixed. If someone can help as I don’t know the coding

19. osmanakay

Plot( C, “Close”, colorbar, styleCandle = 64 | styleNoTitle ); error 247 will you solve thanks and have a nice day

Leave Comment

Please login here to leave a comment.

Back