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-SELL SMA (tiger) for Amibroker (AFL)

Rating:
3 / 5 (Votes 5)
Tags:
trading system, amibroker

Friends, This is based on SINGLE MOVING AVERAGE AFL, USEFULL FOR INTRADAY, SAME TIME CONSIDER THE MARKET TREND ALSO. THANK U.
-SRI VAARI STOCKS, TAMILNADU. (9095090959)

Similar Indicators / Formulas

All in One
Submitted by Nahid over 14 years ago
Kase Peak Osc. V2 batu
Submitted by batu1453 over 10 years ago
Kase CD V2batu
Submitted by batu1453 over 10 years ago
Ichimoku
Submitted by prashantrdx over 10 years ago
Arvind' System
Submitted by akdabc over 14 years ago
Miftha remix for dse
Submitted by coolpace over 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
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
_SECTION_BEGIN
 
( "SingleMA" );
 
SetChartOptions
 
( 0, chartShowArrows | chartShowDates | chartWrapTitle );
 
SetChartBkColor
 
( ParamColor( "Outer Panel", colorBlack ) );
 
SetChartBkGradientFill
 
( ParamColor( "Upper Chart", colorBrown ), ParamColor( "Lower Chart", colorDarkGrey ) );
 
 
 
 
 
Type =
 
    ParamList( "Average Type", "Wilders,SMA,EMA" );
 
P =
 
    Param( "Averaging Period", 20, 3, 100, 1 );
 
Q =
 
    Param( "%Change", 1, 0.1, 10, 0.1 );
 
BP =
 
    Param( "BB Period", 20, 3, 100 );
 
BW =
 
    Param( "BB Width", 2, 0.5, 10, 0.5 );
 
BBOption =
 
    ParamToggle( "Plot BB", "No I Yes" );
 
Report =
 
    ParamList( "Trigs or Update or Tgt-SL?", "Triggers|Update|Tgt-SL" );
 
if
 
 
 
 
 
( Type == "Wilders" )
    A = Wilders( C, P );
 
if
 
 
 
 
 
( Type == "SMA" )
    A = MA( C, P );
 
if
 
 
 
 
 
( Type == "EMA" )
    A = EMA( C, P );
 
SL =
 
    Max( LLV( L, 5 ), Trough( L, Q, 1 ) );
 
Tgt =
 
    2 * H - SL;
 
MeanPrice =
 
    Prec( ( O + C ) / 2, 2 );
 
Part =
 
    100 * ( H - A ) / ( H - L );
 
BBTop =
 
    BBandTop( C, BP, BW );
 
BBBot =
 
    BBandBot( C, BP, BW );
 
Buy
 
= (
 
      Prec( C, 2 ) > Prec( A, 2 ) ) AND Part > 70;
 
Sell
 
 
 
= H < A;
 
Buy
 
=
 
    ExRem( Buy, Sell );
 
Sell
 
 
 
=
 
    ExRem( Sell, Buy );
 
Bought =
 
    Flip( Buy, Sell );
 
Sold =
 
    Flip( Sell, Buy );
 
NextTgt =
 
    ValueWhen( Buy, Tgt, 1 );
 
for
 
 
 
 
 
( i = 1; i < BarCount; i++ )
 
{
 
    if ( Bought[i] AND NOT Buy[i] )
 
    {
 
        SL[i] =
 
            Max( SL[i], SL[i - 1] );
 
        if ( C[i - 1] >= 0.9999 * NextTgt[i - 1] )
            NextTgt[i] = Tgt[i - 1];
 
        NextTgt[i] =
 
            Max( NextTgt[i], NextTgt[i - 1] );
 
    }
 
}
 
BuyDate =
 
    ValueWhen( Buy, Ref( DateTime(), 1 ), 1 );
 
BuyPrice
 
=
 
    ValueWhen( Buy, Ref( MeanPrice, 1 ), 1 );
 
SellPrice
 
 
 
=
 
    ValueWhen( Sell, Ref( MeanPrice, 1 ), 1 );
 
TgtReached =
 
    IIf( Bought AND NOT Buy AND C >= 0.9999 * NextTgt, True, False );
 
SLHit =
 
    IIf( Bought AND NOT Buy AND C < SL, True, False );
 
SLHit =
 
    ExRem( SLHit, Buy );
 
//
 
 
 
if
 
 
 
 
 
( TgtReached[BarCount - 1] )
    NextTgt[BarCount - 1] = 2 * H[BarCount -1] - SL[BarCount - 1];
 
//
 
 
 
if
 
 
 
 
 
( Status( "action" ) == actionIndicator )
 
{
 
    Ttl =
 
        EncodeColor( colorTurquoise ) + "Single MA system, INDICATOR FROM SRI VAARI STOCKS" + "\n"
 
        +
 
        WriteIf( Buy, EncodeColor( colorGreen ) + "Buy Triggered Today, Buy this stock Tomorrow.", "" )
 
        +
 
        WriteIf( Sell, EncodeColor( colorRed ) + "Sell Triggered Today, Sell This stock Tomorrow.", "" )
 
        +
 
        EncodeColor( colorTan ) + WriteIf( Bought AND NOT Buy, "Bought @ " + BuyPrice + ". "
 
                                           +
 
                                           "Target Price = " + NextTgt + ", Stop Loss = " + SL + ".\n"
 
                                           +
 
                                           WriteIf( TgtReached, "Target Reached. Next Target = " + Ref( NextTgt, 1 ) + ".\n", "" )
 
                                           +
 
                                           EncodeColor( colorGold ) + "Profit / Loss so far = " + Prec( 100 * ( C - BuyPrice ) / BuyPrice, 2 ) + "%", "" )
 
        +
 
        WriteIf( Sold AND NOT Sell, "Sold @ " + SellPrice + "\nProfit / Loss in Previous Trade = " + Prec( 100 * ( SellPrice - BuyPrice ) / BuyPrice, 2 ) + "%", "" );
    _N( Title = StrFormat( "{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n", V ) + Ttl );
 
    ChartStyle =
 
        ParamStyle( "Chart Type", styleBar, maskAll );
    PlotOHLC( O, H, L, C, "", colorWhite, ChartStyle );
    Plot( A, Type + "(" + P + ")", colorYellow, styleLine | styleThick );
    Plot( IIf( Bought, NextTgt, Null ), "Target", colorDarkTeal, styleLine | styleThick );
    Plot( SL, "Trail SL", colorWhite, styleLine );
    PlotShapes( IIf( Buy, shapeSquare, shapeNone ), colorGreen, 0, L, Offset = -20 );
    PlotShapes( IIf( Buy, shapeSquare, shapeNone ), colorLime, 0, L, Offset = -30 );
    PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorWhite, 0, L, Offset = -25 );
    PlotShapes( IIf( Sell, shapeSquare, shapeNone ), colorRed, 0, H, Offset = 20 );
    PlotShapes( IIf( Sell, shapeSquare, shapeNone ), colorOrange, 0, H, Offset = 30 );
    PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorWhite, 0, H, Offset = -25 );
 
    if ( BBOption )
        Plot( BBtop, "BB-Top", colorPink, styleLine );
 
    if ( BBOption )
        Plot( BBBot, "BB-Bot", colorPink, styleLine );
 
    {
 
        AlertIf( Buy , "SOUND C:\\Windows\\Media\\Raga\\Windows Notify.wav", "Audio alert", 2 );
        AlertIf( Sell , "SOUND C:\\Windows\\Media\\Raga\\Windows Notify.wav", "Audio alert", 2 );
 
    }
 
}
 
 
 
if
 
 
 
 
 
( ( Status( "action" ) == actionExplore ) AND Report == "Triggers" )
 
{
 
    Filter = Buy OR Sell;
 
    SetOption( "NoDefaultColumns", True );
    AddTextColumn( Name(), "Symbol", 77, colorDefault, colorDefault, 120 );
    AddColumn( DateTime(), "Trigger Date", formatDateTime );
    AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar, colorYellow, IIf( Buy, colorGreen, colorRed ) );
    AddColumn( C, "C. M. P.", 6.2 );
    AddColumn( IIf( Buy OR Bought, NextTgt, Null ), "Target", 6.2 );
    AddColumn( IIf( Buy OR Bought, SL, Null ), "StopLoss", 6.2 );
 
}
 
 
 
if( ( Status( "action" ) == actionExplore ) AND Report == "Update" )
 
{
 
    Filter = True;
 
 
 
    SetOption( "NoDefaultColumns", True );
    AddColumn( DateTime(), "Updated On", formatDateTime, colorDefault, colorDefault, 96 );
    AddTextColumn( Name(), "Symbol", 77, colorDefault, colorDefault, 120 );
    AddColumn( BuyDate, "Buy Date", formatDateTime, colorDefault, colorDefault, 96 );
    AddColumn( BuyPrice, "Buy Price", 6.2 );
    AddColumn( NextTgt, "Target", 6.2 );
    AddColumn( SL, "StopLoss", 6.2 );
    AddColumn( C, "CMP", 6.2, colorDefault, colorDefault, 96 );
 
}
 
 
 
if( ( Status( "action" ) == actionExplore ) AND Report == "Tgt-SL" )
{
    Filter = TgtReached OR SLHit;
 
    SetOption( "NoDefaultColumns", True );
    AddColumn( DateTime(), "Updated On", formatDateTime, colorDefault, colorDefault, 96 );
    AddTextColumn( Name(), "Symbol", 77, colorDefault, colorDefault, 120 );
    AddColumn( BuyDate, "Buy Date", formatDateTime, colorDefault, colorDefault, 96 );
    AddColumn( BuyPrice, "Buy Price", 6.2 );
    AddColumn( NextTgt, "Target", 6.2 );
    AddColumn( SL, "StopLoss", 6.2 );
    AddColumn( C, "CMP", 6.2, colorDefault, colorDefault, 96 );
    AddColumn( IIf( TgtReached, 89, 32 ), "Tgt Hit?", formatChar, colorYellow, IIf( TgtReached, colorGreen, colorDefault ) );
    AddColumn( IIf( TgtReached, 2 * H - SL, Null ), "Next Tgt", 1.2 );
    AddColumn( IIf( SLHit, 89, 32 ), "SL-Hit", formatChar, colorYellow, IIf( SLHit, colorRed, colorDefault ) );
 
}
 
_SECTION_END();

0 comments

Leave Comment

Please login here to leave a comment.

Back