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

Didi Index Trading System with BB, RSI and volume and complete exploration for Amibroker (AFL)

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

Hi this is a modified DIDI Index Trading system containing RSI, BB and complete exploration. Feel free to use.

Cheers

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Price");
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

SetPositionSize(100,spsShares);
//SetPositionSize(25,spsPercentOfEquity);

small = 3;
medium = 13;
large =20;

sEMA = EMA(C,small);
mEMA = EMA(C,medium);
lEMA = EMA(C,large);

sEMA = sEMA/mEMA;
lEMA = lEMA/mEMA;

//Plot(sEMA,"sEMA",colorred);
//Plot(lEMA,"lEMA",colorGreen);

Cover=Cross(sEMA,lEMA);
Sell=Cross(lEMA,sEMA);


PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

Filter = 1;// Buy OR Sell ;
AddColumn(Close, "Close",1.2, colorDefault,2,50);
AddColumn(Volume, "Vol",1.2, colorDefault,2,50);
AddColumn(IIf(Cover,BuyPrice,Null),"Buy-Main", 1.2,1,colorGreen,50);
AddColumn(IIf(Sell,ShortPrice,Null),"Sell-Main" ,1.2,1,colorOrange,50);

_SECTION_END();

_SECTION_BEGIN("Price");
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

SetPositionSize(100,spsShares);
//SetPositionSize(25,spsPercentOfEquity);

small = 3;
medium = 13;
large =20;

sEMA = EMA(C,small);
mEMA = EMA(C,medium);
lEMA = EMA(C,large);

sEMA = sEMA/mEMA;
lEMA = lEMA/mEMA;

//Plot(sEMA,"sEMA",colorred);
//Plot(lEMA,"lEMA",colorGreen);

Cover=Cross(sEMA,lEMA);
Sell=Cross(lEMA,sEMA);


PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

Filter = 1;// Buy OR Sell ;
AddColumn(Close, "Close",1.2, colorDefault,2,50);
AddColumn(Volume, "Vol",1.2, colorDefault,2,50);
AddColumn(IIf(Cover,BuyPrice,Null),"Buy-Main", 1.2,1,colorGreen,50);
AddColumn(IIf(Sell,ShortPrice,Null),"Sell-Main" ,1.2,1,colorOrange,50);

_SECTION_END();


_SECTION_BEGIN("BB-Keltner");
Length = 14;
Price = EMA(Close, Length);

// Keltner 
kLength = Length;
kN = 1.5;
kATR = ATR(kLength);
kUpper = Price + kN * kATR;
kLower = Price - kN * kATR;
 
// Bollinger
bbLength = Length;
bbN = 2;
bbStDevValues = StDev(Close, bbLength);
bbUpper = Price + bbN * bbStDevValues;
bbLower = Price - bbN * bbStDevValues;
 
IsBBSqueeze = bbUpper <= kUpper AND bbLower >= kLower;

Proportion = (kUpper - kLower) / (bbUpper - bbLower);
BBBreakout = Cross(1,Proportion); 
Periods = Param("BBPeriods", 14, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
bbtop=BBandTop( C, Periods, Width );
bbbot=BBandBot( C, Periods, Width );
Plot(bbtop, "", Color, Style ); 
Plot(bbbot , "", Color, Style );

sqeezcolor=ColorRGB(194,220,218);

PlotOHLC( bbtop,bbtop, bbbot,bbbot, "",IIf(IsBBSqueeze,colorYellow,colorWhite), styleCloud|styleNoRescale,  Null, Null, Null, -1 );
Plot(Close,"Close",colorGreen,styleCandle); 

Filter = BBBreakout;

AddColumn(BBBreakout, "BB Breakout", 1, colorWhite, IIf(BBBreakout==1, colorRed, colorWhite));
AddColumn(bbUpper,"(BB Upper) ",1.2, colorRed,colorBlack,70) ;
AddColumn(bbLower,"(BB Lower)",1.2,colorPaleGreen,colorBlack,70);



//set default sorting to Date/time in descending order in results window
SetSortColumns(-2);
_SECTION_END();

//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 */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

_SECTION_BEGIN("EMA2");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

_SECTION_BEGIN("RSI Prediction");
Value1 = Param("RSI BearResistance", 70, 1, 100, 0.1 );
Value2 = Param("RSI BullSupport", 30, 1, 100, 0.1 );
WildPer = Param("Time periods", 15, 1, 100 );
ExpPer = 2 * WildPer - 1;
AUC = EMA( Max( C - Ref( C, -1 ), 0 ), ExpPer );
ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer );
x1 = (WildPer - 1) * ( ADC * Value1 / (100-Value1) - AUC);
RevEngRSI1 = IIf( x1 >= 0, C + x1, C + x1 * (100-Value1)/Value1 );
x2 = (WildPer - 1) * ( ADC * Value2 / (100-Value2) - AUC);
RevEngRSI2 = IIf( x2 >= 0, C + x2, C + x2 * (100-Value2)/Value2 );
 
Plot( Close, Date()+", Close ", colorWhite, styleCandle );
Plot( RevEngRSI1, "RSIBearResistance( "+WriteVal(WildPer,1.0)+", "+ WriteVal(Value1, 1.2)+" )", colorRed );
Plot( RevEngRSI2, "RSIBullSupport( "+WriteVal(WildPer,1.0)+", "+ WriteVal(Value2, 1.2)+" )", colorGreen );

Buy=Cross(C,RevEngRSI2);
Short=Cross(RevEngRSI1,C);
BuyPrice=ValueWhen(Buy,C,1);
ShortPrice=ValueWhen(Short,C,1);
PlotShapes(Buy*shapeSmallUpTriangle, colorGreen,0,L,-15);
PlotShapes(Short*shapeSmallDownTriangle, colorRed,0,H,-15);


Filter = 1;// Buy OR Short ;
AddColumn(RevEngRSI1,"(Rsi 70) ",1.2, colorRed,colorBlack,70) ;
AddColumn(RevEngRSI2,"(Rsi 30)",1.2,colorPaleGreen,colorBlack,70);

AddColumn(IIf(Buy,BuyPrice,Null),"Buy-RSI", 1.2,1,colorGreen,50);
AddColumn(IIf(Short,ShortPrice,Null),"Sell-RSI" ,1.2,1,colorOrange,50); 

_SECTION_END();

_SECTION_BEGIN("Volume1");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick, maskHistogram  ) );
_SECTION_END();



////Looks up Future Quotes--------------
_SECTION_BEGIN("Support");
("Price");
RSIperiod = 15; // Param("RSI p",3,14,30,1);
Percent = 5; // Param("ZIG %",8,9,15,1);
EMAperiod = 5; //Param("EMA p",4,5,10,1);
HHVperiod = 8; //Param("HHV p",3,5,10,1);
NumLine = 2; //Param("Num Lines",3,1,20,1);

Base = DEMA(RSI(RSIperiod),EMAperiod);

GraphXSpace=0.5;


for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed, styleLine);
Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine);
}

////Looks up Future Quotes-----------------



_SECTION_BEGIN("Modified MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );

ml=MACD(r1,r2);
sl= Signal(r1,r2,r3);

x = ml;
y = sl;



Buy=Cross(x,y);
Sell=Cross(y,x);
AlertIf( Buy, "SOUND C:\\Windows\\Media\\notify.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 2 );

Filter = 1;// Buy OR Short ;

AddColumn(x,"(Modified MACD (12,26)) ",1.2, colorRed,colorBlack,70) ;
AddColumn(y,"(Signal (12,26,9))",1.2,colorPaleGreen,colorBlack,70);
AddColumn(IIf(Buy,BuyPrice,Null),"Buy-MACD", 1.2,1,colorGreen,50);
AddColumn(IIf(Sell,ShortPrice,Null),"Sell-MACD" ,1.2,1,colorOrange,50); 

_SECTION_END();

 

0 comments

Leave Comment

Please login here to leave a comment.

Back