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

Buy&VSTOP&PIV&TGL 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
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
// VSTOP&ATR
// E.M.Pottasch, Jul 2010
// from Metastock formula, link: http://stocata.org/metastock/stop_trail_atr.html
// added separate parameters for upward and downward market environment
 
function vstop_func(trBull,trBear)
{
    trailArray[ 0 ] = C[ 0 ]; // initialize
    for( i = 1; i < BarCount; i++ )
    {
        prev = trailArray[ i - 1 ];
  
        if (C[ i ] > prev AND C[ i - 1 ] > prev)
        {
            trailArray[ i ] = Max(prev,C[ i ] - trBull[ i ]);
        }
        else if (C[ i ] < prev AND C[ i - 1 ] < prev)
        {
            trailArray[ i ] = Min(prev,C[ i ] + trBear[ i ]);
        }
        else if (C[ i ] > prev)
        {
            trailArray[ i ] = C[ i ] - trBull[ i ];
        }
        else
        {
            trailArray[ i ] = C[ i ] + trBear[ i ];
        }
    }
    return trailArray;
}
 
ATRper = Param("ATRper",14,1,50,1,0) ;
 
Res = Param("AtrMultRes",2,1,10,0.1,0) ;
Sup = Param("AtrMultSup",1.5,1,10,0.1,0) ;
 
trBear = res * ATR(atrper);
trBull = sup  * ATR(atrper);
 
trailArray = vstop_func(trbull,trbear);
 
//Plot(IIf(trailArray > C,trailArray,Null),"\nResATR",colorBlue,styleStaircase+styleThick);
//Plot(IIf(trailArray < C,trailArray,Null),"\nSupATR",colorRed,styleStaircase+styleThick);
Plot(IIf(trailArray > C,trailArray,Null),"\nResATR",colorBlue,8+16) ;
Plot(IIf(trailArray < C,trailArray,Null),"\nSupATR",colorRed,8+16) ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//TRAILING STOP LOSS PERCENTAGE
//The formula draws a stoploss loss line which will be "StopLossPercentage" below the highest close
// within a lookback period of "LookbackPeriod" bars.
//lookbackPeriod = Param("LookbackPeriod", 20, 1, 30);
LBper = Param("LookbackPer",14,2,60,1,0) ;
//StoplossPercentage = Param("StoplossPercentage", 3, 0.2, 10);
SL= Param("StopLoss%",3,1,10,0.1,0) ;
TSL= HHV(C,LBper) - HHV(C,LBper) * (SL / 100) ;
//Plot(TSL, "\nStopLoss%",colorRed,styleLine+styleThick);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//TRENDADVISOR
 
pointer[0] = 0;
 
/* Phase filter */
 
Cond1 = Close > MA(Close, 50)AND NOT(Close > MA(Close, 200))AND NOT(MA(Close, 50) > MA(Close, 200));
Cond2 = Close > MA(Close, 50)AND Close > MA(Close, 200)AND NOT(MA(Close, 50) > MA(Close, 200));
Cond3 = Close > MA(Close, 50)AND Close > MA(Close, 200)AND MA(Close, 50) > MA(Close, 200);
Cond4 = NOT(Close > MA(Close, 50))AND Close > MA(Close, 200)AND MA(Close, 50) > MA(Close, 200);
Cond5 = NOT(Close > MA(Close, 50))AND NOT(Close > MA(Close, 200))AND MA(Close, 50) > MA(Close, 200);
Cond6 = NOT(Close > MA(Close, 50))AND NOT(Close > MA(Close, 200))AND NOT(MA(Close, 50) > MA(Close, 200));
 
for (i = 1; i < BarCount; i++)
{
 
  if (Cond1[i])
    pointer[i] = 1;
  if (Cond2[i])
    pointer[i] = 2;
  if (Cond3[i])
    pointer[i] = 3;
  if (Cond4[i])
    pointer[i] = 4;
  if (Cond5[i])
    pointer[i] = 5;
  if (Cond6[i])
    pointer[i] = 6;
 
}
 
/* Plot Graphic */
//GraphXSpace= 15 ;
dynamic_color = IIf(pointer < 4, colorGreen, colorRed);
//Plot(pointer, "TrendAdv2", dynamic_color, styleHistogram | styleThick, Null, Null, 0);
//SetChartBkGradientFill(ParamColor("BgTop", colorWhite), ParamColor("BgBottom", colorLightYellow));
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//PRICE
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{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, "", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//TRENDING RIBBON
// Paste the code below to your price chart somewhere and green ribbon means both
// both MACD and ADX trending up so if the red ribbon shows up the MACD and the ADX
// are both trending down.
_SECTION_BEGIN("trending ribbon");
uptrend= (PDI()>MDI() AND MACD()>Signal()) ;
downtrend=MDI()>PDI() AND Signal()>MACD();
Plot( 2, /* defines the height of the ribbon in percent of pane width */"",
    IIf( uptrend AND EMA(C,50)>=Ref(EMA(C,50),-1), colorLime, IIf( downtrend OR EMA(C,50)<Ref(EMA(C,50),-1),
     colorRed, colorTan)) , /* choose color */styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//HEIKIN-ASHI ORIGINAL
SetChartOptions(0,chartShowArrows | chartShowDates);
HaClose = (O + H + L + C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * 10000;
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
//SetBarFillColor(IIf(HaClose>=HaOpen,colorBrightGreen,colorOrange));
//PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "\nHeikin-ashi", barcolor, styleCandle );
HaDelta= HaClose-HaOpen ;
MAhadelta= MA(Hadelta,3) ;
Hadeltaup3 = Hadelta>MA(Hadelta,3) ;
mahadeltaup0= MA(Hadelta,3)>0 ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//BULL BEAR VOLUME
/*
A approximation of the average Bull Volume component versus the average Bear Volume component of total Volume.
Displays an interesting and helpful view of the ebb and flow of Bull and Bear Volume pressure in the market.
Shows what the bears are up to while the bulls are in control and vice versa.
You can see bull pressure building (or bear pressure diminishing) in advance of a bullish price move
(especially in sideways markets and horizonal rectangular consolidations).
The graph moves in curves from which you can often extrapolate reasonably accurate and useful projections
of future Bull or Bear Volume Action.
 
Features:
 Total Volume MA Histogram and Line
 Bull Volume MA Histogram and Line
 Bear Volume MA Histogram and Line
 Currently Selected Bull Volume Level
 Currently Selected Bear Volume Level
 Bull/Bear Volume Convergence/Divergence Oscillator
 Rising and Falling Convergence/Divergence  Background Shadows
 
***All components of the indicator can be toggled on and off via the parameter window if the display
is too busy or too sparse for your tastes. Set your own defaults in the code.***
 
I tried to use all AB color constants for compatibility but the available greys are too dark.
In this case I have supplied the RGB values for the custom greys I used in the Rise/Fall Background Shadows.
If your color scheme is radically different than the default gray background you may have to redo all the colors to your satisfaction.
 
Known Issues: 
Sometimes the volume will dip slightly below the zero line, especially at the beginning of the chart.
I think this is related to the lookback periods for the TEMA's  and the uneven distribution
of up and down days in the market- I don't think it voids the reliability or usefulness of the indicator.
When I figure out how to fix it I will post the updated code.
Or if anyone knows the cause and fix please let me know via email or post the fix in the comments section.
 
If you find this indicator helpful, or if you find any error in logic or coding,
or if you see a better way to display this information, please drop me an email at:
"nkm at dr dot com"
...and let me know - I'd love to get the feedback.
Best Regards,
Nick Molchanoff
*/
 
/* basic variable defs
 ud: up-Day (Close up from Open)
 dd: down-Day (Close down from Open)
 uc: up-Close (Close up from previous Close)
 dc: down-Close: (Close down from previous Close)
*/
C1 = Ref(C, -1);
uc = C > C1; dc = C <= C1;
ud = C > O; dd = C <= O;
 
/*
Volume Day types:
 green: up-day and up-close
 yellow: up-day but down-close
 red: down-day and down-close
 blue: down-day but up-close
 white: close equals open, close equals previous close
 
(currently unused vtypes are for future enhancements)
*/
green = 1; blue = 2; yellow = 3; red = 4; white = 5;
VType = IIf(ud,            
            IIf(uc, green, yellow),
         IIf(dd,
            IIf(dc, red, blue), white));
 
/* green volume: up-day and up-close*/
gv = IIf(VType == green, V, 0);
/* yellow volume: up-day but down-close */
yv = IIf(VType == yellow, V, 0);
/* red volume: down-day and down-close */
rv = IIf(VType == red, V, 0);
/* blue volume: down-day but up-close */
bv = IIf(VType == blue, V, 0);
 
/* split up volume of up-close days from down-close days - (for the purposes of this volume display indicator,
up-days that closed down from the previous close are considered bearish volume days, and conversely,
down-days that nevertheless closed up from the previous close are considered bullish volume days -
my testing indicates this is more accurate than using ordinary up-days and down-days) */
uv = gv + bv; uv1 = Ref(uv, -1); /* up volume */
dv = rv + yv; dv1 = Ref(dv, -1); /* down volume */
 
/* create moving average period parameters */
VolPer = Param("Adjust Vol. MA per.", 21, 1, 255, 1);
ConvPer = Param("Adjust Conv. MA per.", 7, 1, 255, 1);
 
/* create triple exponential moving avearges of separate up and down volume moving averages */
MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1);
MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1);
MAtv = TEMA(V, VolPer );//total volume
 
/* Switch for Horizontal lines indicating current level of positive and negative volume
for ease in comparing to past highs/lows - toggle via parmameter window */
OscillatorOnly = Param("Show Oscillator Only", 0, 0, 1, 1);
CompareBullVolume = Param("Show Bull Level", 1, 0, 1, 1);
if(CompareBullvolume AND !OscillatorOnly){
//Plot(SelectedValue(MAuv), "", colorGreen, styleLine);
}
 
CompareBearVolume = Param("Show Bear Level", 1, 0, 1, 1);
if(CompareBearVolume AND !OscillatorOnly){
//Plot(SelectedValue(MAdv), "", colorRed, styleLine);
}
 
/* Volume Segment Switches - toggle via parameter window */
bullvolume = Param("Show Bull Volume", 1, 0, 1, 1);
bearvolume = Param("Show Bear Volume", 1, 0, 1, 1);
totalvolume = Param("Show Total Volume", 1, 0, 1, 1);
 
/* plot volume lines and histograms if toggled on: */
bearToFront = Param("Show Bear Vol in Front", 0, 0, 1, 1);
if(bearToFront AND !OscillatorOnly){
//Plot(MAdv, "", colorRed, styleHistogram|styleNoLabel);
}
if(bullvolume AND !OscillatorOnly){
//Plot(MAuv, "Average Bull Volume", colorGreen, styleHistogram|styleNoLabel);
}
if(bearvolume AND !OscillatorOnly){
//Plot(MAdv, "Average Bear Volume", colorRed, styleHistogram|styleNoLabel);
}
if(totalVolume AND !OscillatorOnly){
//Plot(MAtv, "MA(TotVol)", colorTan, styleHistogram|styleNoLabel);
//Plot(MAtv, "", colorTan, styleLine);
}
if(bullvolume AND !OscillatorOnly){
//Plot(MAuv, "", colorGreen, styleLine);
}
if(bearvolume AND !OscillatorOnly){
//Plot(MAdv, "", colorRed, styleLine);
}
 
/* better visibility of zero line: */
//Plot(0, "", colorBlue, 1);
 
/* Rise/Fall Convergence variables:  */
Converge = (TEMA(MAuv - MAdv, ConvPer));
Converge1 = Ref(Converge, -1);
ConvergeUp = Converge > Converge1;
ConvergeOver = Converge > 0;
rising = ConvergeUp AND ConvergeOver;
falling = !ConvergeUp AND ConvergeOver;
 
/* Rise/Fall Convergence Oscillator Switch  - toggle via parameter window -
(provides a better view of resulting combination of battling bull/bear volume forces) */
convergenceOscillator = Param("Show Oscillator", 0, 0, 1, 1);
if(convergenceOscillator OR OscillatorOnly){
//Plot(Converge, "Bull/Bear Volume Convergence/Divergence", colorViolet, 1|styleLeftAxisScale|styleNoLabel|styleThick);
//Plot(0,"", colorYellow, 1|styleLeftAxisScale|styleNoLabel);
}
 
/********************************************************
 Convergence Rise/Fall Shadows:
 
 (provides a more easily visible display of rising and falling  bull/bear volume convergence) - toggle via parameter window
 
-posiitive Volume exceeding negative Volume: Light shadow
-negative volume exceeding positive volume: dark shadow
-if you use standard gray background - best shadows are:
-my greys: 14 = (216, 216, 216); 15 = (168, 168, 168));
-best substitute? using AB color constants?
-light: colorpalegreen; dark: colorRose;?
-(depends on your color scheme - customize to your tastes)
**********************************************************/
 
/* uncomment if you use my custom color greys: */
riseFallColor = IIf(rising, 14,15); //my custom shadow greys
 
/* comment out if you use my custom color gray shadows: */
/* riseFallColor = IIf(rising, colorPaleGreen,colorRose); */
 
/* Rise/Fall Convergence Plot Switch - toggle via parameter window */
riseFallShadows = Param("Show RiseFallShadows", 0, 0, 1, 1);
if(riseFallShadows){
//Plot(IIf(rising OR falling, 1, 0), "", riseFallColor, styleHistogram|styleArea|styleOwnScale|styleNoLabel);
}
GraphXSpace = 0.5;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
// BB MIDDLE
BBMiddle = BBandBot(C,20,2) + ((BBandTop(C,20,2)-BBandBot(C,20,2))/2);
MIDCOL= IIf(BBMIDDLE>Ref(BBMIDDLE,-1),colorBlue,colorAqua) ;
BBMidUp= BBMIDDLE>Ref(BBMIDDLE,-1) ;
//Plot(BBMiddle , "\nBBMiddle" + _PARAM_VALUES(), midcol, styleDots );
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//SMA 5~5
 
sma10 = MA(Close,10);
sma10col1= IIf(sma10>Ref(sma10,-1),colorLime,colorRed) ;
sma10col2= IIf(sma10>Ref(sma10,-1),colorBlue,colorAqua) ;
//Plot(sma10, "\nBack MA", sma10col1, styleDots, Null, Null, -5);
//Plot(sma10, "\nForward MA", sma10col2, styleDots, Null, Null, 5);
 
//Cp= Ref(sma10,5)>Ref(sma10,-5) ;
//Vd= Ref(sma10,5)<Ref(sma10,-5) ;
 
//barcolor = IIf(C>O,colorLime,colorPink);
//SetBarFillColor(IIf(C>O,colorBrightGreen,colorYellow));
 
//Plot(Close, "Close", barcolor, styleCandle);
 
Cpsma10= Ref(sma10,5)>Ref(sma10,-5) ;
Vdsma10= Ref(sma10,5)<Ref(sma10,-5) ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//RSI&HA
_SECTION_BEGIN("RSI&Heikin-Ashi");
periodsrsi = Param( "Periodsrsi", 15, 1, 200, 1 );
HaClosersi = (RSIa(Open, periodsrsi)+RSIa(High, periodsrsi)+RSIa(Low,periodsrsi)+RSIa(Close,periodsrsi))/4;
HaOpenrsi = AMA( Ref( HaClosersi, -1 ), 0.5 );
HaHighrsi = Max( RSIa(High, periodsrsi), Max( HaClosersi, HaOpenrsi ) );
HaLowrsi = Min( RSIa(Low,periodsrsi), Min( HaClosersi, HaOpenrsi ) );
barcolorrsi= IIf(HaClosersi>=HaOpenrsi,colorGreen,colorRed) ;
//SetBarFillColor(IIf(HaClosersi>=HaOpenrsi,colorLime,colorRed));
//PlotOHLC( HaOpenrsi, HaHighrsi, HaLowrsi, HaClosersi, _DEFAULT_NAME(), barcolorrsi, styleCandle );
//Plot(70,"",colorRed,styleLine|styleThick);
//Plot(30,"",colorLime,styleLine|styleThick);
//Plot(50,"",colorBrown,styleLine|styleThick);
_SECTION_END();
 
rsiha= HaClosersi>=HaOpenrsi ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//Z-SCORE
 
/*-----------------------------------------------------------
MTR Investors Group - www.MTRIG.com
 
Statistical Z-Score Indicator: Tracks how many standard
deviations the price is from the mean.
 
For more information on this indicator see the links below.
 
MTRIG - Reference
http://blog.mtrig.com/mtrig/blog/page/Z-Score-Indicator.aspx
 
Z-Score Trader's Notebook Article
http://premium.working-money.com/wm/display.asp?art=344
 
AMIBroker forumula on Traders.com
http://www.traders.com/Documentation/FEEDbk_docs/Archive/022003/TradersTips/TradersTips.html
 
Z-Score in Wikipedia
http://en.wikipedia.org/wiki/Standard_score
 
MTRIG.com is the only site (we know of) that has the Z-Score
indicator live on our web charts.
-------------------------------------------------------------*/
 
periods = Param( "Period", 20, 1,3, 1);
 
ZScore = ( Close - MA( Close, periods ) ) / StDev( Close, periods );
zscorecolor= IIf(zscore>0,colorLime,colorRed) ;
//Plot(ZScore, "Z-Score", zscorecolor,styleHistogram | styleThick );
//Plot(2, "", colorBlue);
//Plot(0, "", colorBrown );
//Plot(-2, "", colorBlue);
ZScoreup0= ZScore>0 ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//BB HISTOGRAM
 
_SECTION_BEGIN("BB Histogram");
bbhist=((C+2*StDev(C,20) - MA(C,18)) / ((4*StDev(C,18)))*4) - 2;
//Plot(bbhist, "BBands Histogram", IIf(bbhist > 0, colorLime, colorRed),styleHistogram + styleThick);
_SECTION_END();
bbhistup0= bbhist>0 ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//FORMULE
stochup= StochK()>StochD() ;
stoch80= StochK()<80 ;
MACDup= MACD()>Signal() ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
MFIupema5= MFI()>EMA(MFI(),5) ;
MFI30= MFI()>30 ;
Cupo= C>O ;
MA10up= MA(C,10)>=Ref(MA(C,10),-1) ;
MA20up= MA(C,20)>=Ref(MA(C,20),-1) ;
EMA50up= EMA(C,50)>=Ref(EMA(C,50),-1) ;
CupEMA50= C>EMA(C,50) ;
Cupma20= C>MA(C,20) ;
PDIupmdi= PDI()>MDI() ;
CCIup0= CCI()>0 ;
Cond= pointer<4 ;
top2up= BBandTop(C,20,2)>=Ref(BBandTop(C,20,2),-1) ;
top1up= BBandTop(C,20,1)>=Ref(BBandTop(C,20,1),-1) ;
Cuptop1= C>BBandTop( C, 20,1 ) ;
buystop= C>trailArray ;
haup= HaClose>=HaOpen ;
Vup= MAuv>MAdv ;
myvup= (Vup OR MFIupema5) ;
Lim= (ADX()<50 AND MFI()>30) ;
ADX50= ADX()<50 ;
Cuptsl= C>tsl ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
//PARAMTOGGLE
// This combines indicators into one timing Signal
//function ParamOptimize( description, default, minv, maxv, step )
//    { return Optimize(description, Param(description,default, minv, maxv, step ), minv, maxv, step ); }
tgl = ParamToggle("Result", "AND logic|Compare");
// switch test calculation and compare the results
if(tgl)
{
myBuy = buystop AND Cupo AND Haup AND RSIha AND bbhist AND maHadeltaup0 ;
myShort = !buystop ;
}
else
{
myBuy   = IIf( C>trailArray AND C>O AND HaClose>=HaOpen AND HaClosersi>=HaOpenrsi AND bbhist>0 AND
           MA(Hadelta,3)>0      ,1,0);
myShort = IIf( C<trailArray     ,1,0);
}
 
Buy = ExRem(myBuy, myShort);
Sell = ExRem(myShort, myBuy);
 
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-10);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,High,Offset=-10);
 
 
 
 
_SECTION_BEGIN("Tomorrow'sPivotsPUR");
 
//TOMORROW'S PIVOTS
//Description:
//I had been struggling with the code to Plot todays pivots from yesterdays price
//when using an intraday database.There were none available in the Amibroker library
//which plotted correctly the pivots for tomorrow on a intraday database.
//I checked the Amibroker forum AND found the following. Thank you goes to sdebu_2k.
//If you wish to go to the forum search for "plotting tomorrow pivots".
//This routine provides todays quotes in the Title bar AND holds the todays pivots constant
//in the Title bar as well. The plotted pivots moves to the next Day
//when entering into the next Day. Absolutely brilliant! Thank you.
//PATRICK DOHERTY//
//SetChartOptions(0,chartShowArrows|chartShowDates);
//_N(Title = StrFormat("{{NAME}} - {{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", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
H1=SelectedValue( TimeFrameGetPrice( "H", inDaily, -1 ));
L1=SelectedValue(TimeFrameGetPrice( "L", inDaily, -1 ));
C1=SelectedValue(TimeFrameGetPrice( "C", inDaily, -1 ));
/*PIVOT Calculation*/
p = ( H1+ L1 + C1 )/3;
s1 = (2*p)-H1;
r1 = (2*p)-L1;
s2 = p -(H1 - L1);
s3 = S1 - (H1-L1);
r2 = p +(H1 - L1);
r3 = R1 +(H1-L1);
 
Plot (p,"Pivot",25,styleDots);
Plot (r1,"",12,1);
Plot (r2,"",12,1);
Plot (r3,"",12,1);
Plot (s1,"",3,1);
Plot (s2,"",3,1);
Plot (s3,"",3,1);
X=Cross(C,p);
Z=Cross(p,C);
PlotShapes(IIf(X,shapeUpTriangle,shapeNone),colorAqua,0,Low,Offset=-20);
PlotShapes(IIf(Z,shapeDownTriangle,shapeNone),colorPink,0,High,Offset=-20);
 
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Back