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

tl 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
_SECTION_BEGIN( "Trendline " );
// E.M.Pottasch, 3/2015
SetChartOptions( 0, chartShowArrows | chartShowDates );
 
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
 
size = Param( "ZigZag-Sensitivity", 5, 0.1, 100, 0.1 ) ; // Size for the trendline
gs = ParamToggle( "Price Toggle", "H/L|C", 1 );
 
xx = x = BarIndex();
fvb = FirstVisibleValue( x );
lvb = LastVisibleValue( x );
 
if ( gs )
{
    pk = Peak( c, Size ) == c AND Zig( c, Size ) == c;
    tr = Trough( c, Size ) == c AND Zig( c, Size ) == c;
 
    px0 = ValueWhen( pk, x, 0 );
    tx0 = ValueWhen( tr, x, 0 );
    px1 = ValueWhen( pk, x, 1 );
    tx1 = ValueWhen( tr, x, 1 );
    px2 = ValueWhen( pk, x, 2 );
    tx2 = ValueWhen( tr, x, 2 );
    ph0 = ValueWhen( pk, C, 0 );
    tl0 = ValueWhen( tr, C, 0 );
    ph1 = ValueWhen( pk, C, 1 );
    tl1 = ValueWhen( tr, C, 1 );
    ph2 = ValueWhen( pk, C, 2 );
    tl2 = ValueWhen( tr, C, 2 );
}
else
{
    pk = Peak( H, Size ) == H AND Zig( H, Size ) == H;
    tr = Trough( L, Size ) == L AND Zig( L, Size ) == L;
 
    px0 = ValueWhen( pk, x, 0 );
    tx0 = ValueWhen( tr, x, 0 );
    px1 = ValueWhen( pk, x, 1 );
    tx1 = ValueWhen( tr, x, 1 );
    px2 = ValueWhen( pk, x, 2 );
    tx2 = ValueWhen( tr, x, 2 );
    ph0 = ValueWhen( pk, H, 0 );
    tl0 = ValueWhen( tr, L, 0 );
    ph1 = ValueWhen( pk, H, 1 );
    tl1 = ValueWhen( tr, L, 1 );
    ph2 = ValueWhen( pk, H, 2 );
    tl2 = ValueWhen( tr, L, 2 );
}
 
ll = tr AND tl1 < tl2;
 
hl = tr AND tl1 > tl2;
hh = pk AND ph1 > ph2;
lh = pk AND ph1 < ph2;
dt = pk AND ph1 == ph2;
db = tr AND tl1 == tl2;
 
Plot( C, "C", colorWhite, styleCandle, Null, Null, 0, 0, 1 );
PlotShapes( shapeCircle*pk, ColorRGB( 255, 0, 0 ), 0, H, 10 );
PlotShapes( shapeCircle*tr, ColorRGB( 0, 255, 0 ), 0, L, -10 );
 
if ( gs )
    Plot( Zig( c, Size ), "Zig", ColorRGB( 50, 50, 50 ), styleDashed, Null, Null, 0, 0, 1 );
 
for ( i = lvb;i > fvb;i-- )
{
    {
        if ( ll[i] )
            PlotTextSetFont( "LL", "Arial Black", 8, i, L[i], colorGreen, colorDefault, -30 );
 
        if ( hl[i] )
            PlotTextSetFont( "HL", "Arial Black", 8, i, L[i], colorGreen, colorDefault, -30 );
 
        if ( db[i] )
            PlotTextSetFont( "DB", "Arial Black", 8, i, L[i], colorLightBlue, colorDefault, -30 );
 
        if ( hh[i] )
            PlotTextSetFont( "HH", "Arial Black", 8, i, H[i], colorRed, colorDefault, 20 );
 
        if ( lh[i] )
            PlotTextSetFont( "LH", "Arial Black", 8, i, H[i], colorRed, colorDefault, 20 );
 
        if ( dt[i] )
            PlotTextSetFont( "DT", "Arial Black", 8, i, H[i], colorOrange, colorDefault, 20 );
    }
}
 
cnta = cntb = 0;
 
for ( i = lvb;i > fvb;i-- )
{
    if ( pk[ i ] AND ph2[i] > ph1[i] AND cnta < 200 )
    {
        x2 = px2[i];
        x1 = px1[i];
        x0 = px0[i];
        y2 = ph2[i];
        y1 = ph1[i];
 
        if ( x0 == x1 )
            x0 = BarCount - 1;
 
        Line = LineArray( x2, y2, x1, y1, 1 );
 
        idx2 = xx == x2;
 
        idx1 = xx == x0;
 
        idx = Flip( idx2, idx1 );
 
        Line = IIf( idx, Line, Null );
 
        Plot( Line, "", colorred, 1, Null, Null, 0, 1, 2 );
 
        cnta = cnta + 1;
    }
 
    if ( tr[ i ] AND tl2[i] < tl1[i] AND cntb < 200 )
    {
        x2 = tx2[i];
        x1 = tx1[i];
        x0 = tx0[i];
        y2 = tl2[i];
        y1 = tl1[i];
 
        if ( x0 == x1 )
            x0 = BarCount - 1;
 
        Line = LineArray( x2, y2, x1, y1, 1 );
 
        idx2 = xx == x2;
 
        idx1 = xx == x0;
 
        idx = Flip( idx2, idx1 );
 
        Line = IIf( idx, Line, Null );
 
        Plot( Line, "", colorgreen, 1, Null, Null, 0, 1, 2 );
 
        cntb = cntb + 1;
    }
}
_SECTION_END();
Back