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

NIFTY SUPERTREND SYSTEM for Amibroker (AFL)

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

DESIGNED FOR NIFTY FUTURES; FOR 5 MINUTE TIMEFRAME; TARGET AS PER ONE’S WISH

Similar Indicators / Formulas

Trend Oscillator
Submitted by Mehul Patel about 15 years ago
Stock trend
Submitted by raj_guna2011 almost 14 years ago
TREND INDICATOR WITH CCI
Submitted by sudesh almost 15 years ago
RMO with ADX
Submitted by manojsh almost 15 years ago
The Unique Trend Detector
Submitted by chynthia about 15 years ago
Turtle Trading System Revision A
Submitted by cnbondre 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
_SECTION_BEGIN("NIFTY SuperTrend");
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(1,chartShowArrows|chartShowDates|chartWrapTitle);
 
 
GraphXSpace = 15;
 
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);
SetChartBkGradientFill( ParamColor( "TopColor", ColorRGB( 0, 255, 255 ) ), ParamColor( "BottomColor", ColorRGB( 0, 255, 255 ) ) );
 
//SetTradeDelays(1,1,1,1);
Period   = Param("Period", 800, 1, 2400, 1);
mult   = Param("Multiplier", 8, 1.1, 20.0, 0.01);  //   5 minutes chart.
 
f=ATR(period);
 
VS[0] = Close[0];
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;
 
for( i = period+1; i < BarCount; i++ )
{
 
  vs[i]   = vs[i-1];
  trend[i]   = trend[i-1];
  highC[i]   = HighC[i-1];
  lowc[i]   = lowc[i-1];
 
   if ((trend[i]>=0) && ( C[i] <VS[i] ))
   {
         trend[i] =-1;
         HighC[i] = C[i];
         lowc[i] = C[i];
   }
 
   if ((trend[i]<=0) && (C[i] >VS[i]))
   {
         trend[i]=1;
         HighC[i] = C[i];
         lowc[i] = C[i];
   
 
   if (trend[i]==-1)
   {
      if (C[i]<lowc[i]) lowc[i] = C[i];
    VS[i]= lowc[i]+ (mult*f[i]);
   }
 
 
   if (trend[i]==1) 
   {
      if (C[i]>HighC[i]) HighC[i] = C[i];
    VS[i]= HighC[i]-(mult*f[i]);
   }
 
}
 
Plot(VS, "Vol Stop",IIf(trend==1,colorRed,colorYellow ),styleThick);
 
Buy=Cross(Trend,0);
Short=Cross(0, Trend);
Buy = Ref(Buy, -1);
Short = Ref(Short, -1);
 
Hp = HHV( H, 40 );
Lp = LLV( L, 40 );
 
BarsSincebuy = BarsSince( Buy );
BarsSinceshort = BarsSince( Short );
LastSignal = IIf( BarsSincebuy < BarsSinceshort, 1, -1 );
Sig = WriteIf( BarsSincebuy < BarsSinceshort, "BUY", "SELL" );
 
slPrice = IIf( LastSignal == 1, HighestSince( Buy, Lp ), LowestSince( Short, Hp ) );
initialrisk = IIf( LastSignal == 1, BuyPrice - SLPrice, SLPrice - ShortPrice );
CurrentPL = IIf( LastSignal == 1, C - BuyPrice, SellPrice - C );
 
BuyPrice=ValueWhen(Buy,O);
ShortPrice=ValueWhen(Short,O);
 
entry = IIf( LastSignal == 1, BuyPrice, ShortPrice );
 
PlotShapes(Buy * shapeUpArrow,colorDarkGreen, 0,L, Offset=-45);
PlotShapes(Short * shapeDownArrow,colorDarkRed, 0,H, Offset=-45);
 
 
bars = LastValue( IIf(BarsSincebuy < BarsSinceshort, BarsSincebuy, BarsSinceshort));
Offset = 15;
Clr = IIf(LastValue(LastSignal) == 1, colorGreen, colorRed);
 
 
if ( ParamToggle( "Message Board ", "Show|Hide", 1 ) )
{
    GfxSelectFont( "Tahoma", 11, 700 );
    GfxSetBkMode( 1 );
    GfxSetTextColor( colorWhite );
 
    if ( SelectedValue( LastSignal ) == 1 )
    {
        GfxSelectSolidBrush( colorDarkGreen );
        Datetim = "" + ValueWhen( Buy, Day(), 1 ) + "/" + ValueWhen( Buy, Month(), 1 ) + "/" + ValueWhen( Buy, Year(), 1 ) + " " + ValueWhen( Buy, Hour(), 1 ) + ":" + ValueWhen( Buy, Minute(), 1 );
    }
    else
    {
        GfxSelectSolidBrush( colorDarkRed );
        Datetim = "" + ValueWhen( Short, Day(), 1 ) + "/" + ValueWhen( Short, Month(), 1 ) + "/" + ValueWhen( Short, Year(), 1 ) + " " + ValueWhen( Short, Hour(), 1 ) + ":" + ValueWhen( Short, Minute(), 1 );
    }
 
    pxHeight = Status( "pxchartheight" ) ;
 
    xx = Status( "pxchartwidth" );
    Left = 1100;
    width = 310;
    x = 1.5;
    x2 = 250;
 
    y = pxHeight / 1;
 
    GfxSelectPen( colorLightBlue, 1 );
    GfxRoundRect( x, y - 105, x2, y , 7, 7 ) ;
    GfxTextOut( ( "NIFTY SUPERTREND SYSTEM" ), 25, y - 105 );
    GfxTextOut( ( "Last Signal" ), 10, y - 65 ) ;
    GfxTextOut( ( ": " + Datetim ), 115, y - 65 ) ;
    GfxTextOut( ( "" + sig + " Entry @" ), 10, y - 45 );
    GfxTextOut( ( ": " + entry ), 110, y - 45 );
    GfxTextOut( ( "Current P/L" ), 10, y - 25 );
    GfxTextOut( ( ": " + WriteVal( IIf( sig == "BUY", (  C - entry ), ( entry - C ) ), 2.2 ) ), 110, y - 25);;
    x = 290;
    x2 = 500;
 
}
 
_SECTION_END();
 
_SECTION_BEGIN("L.T.P.");
cx = Param( "cxposn", 1000, 0, 1250, 1 );
cy = Param( "cyposn", 25, 0, 500, 1 );
GfxSelectFont( "Candara", 18, 98, False );
gfxcup  = SelectedValue(C > Ref(C,-1));
gfxpcolor = IIf(gfxcup,colorDarkGreen,colorDarkRed);
GfxSetTextColor(gfxpcolor);
//GfxSetTextColor( colorWhite );
GfxTextOut( "L.T.P.  " + C + " ", cx, cy );
_SECTION_END();
 
_SECTION_BEGIN("trend");
uptrend= Signal(29)<MACD(13);
downtrend= Signal(29)>MACD(13);
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

1 comments

1. sankarjv

Why the name Nifty Super Trend,
As it works for any given symbol
Just one doubt if you can clarify
I think ATR period 800 is too high

Leave Comment

Please login here to leave a comment.

Back