Saturday 17 August 2013

Amibroker Afl for delivery based trading

This post is for those who love technical analysis of shares. Taking a decision based on technical analysis could be a better way of trading or it is like being on the right side of the market. 

For those who are familiar with Amibroker the following Afl could help them take a decision. This indicator when applied on a weekly charts gives some reliable buy signals. But these signals are meant for trading on a delivery basis. Please keep in mind when you buy a stock decide on the targets. Once the  targets are achieved sell the stock and wait for a another opportunity. You can even switch sectors, which is also a good thinking. This Afl was Developed and Conceptualised by Debdulal And Soumya for whom the credit belongs. Please copy the following code to the code editor in the Amibroker window and save in custom formula folder. You can name the code anyway you like. when you double click the newly created Afl you will see the charts. It is better to set the chart on weekly basis to have a meaningful buy or sell signal.

If you have any difficulty, or need clarification please mail me.

Good trading!!

_SECTION_BEGIN("debdulal");
//Title="Indicator Developed and Conceptualised by Debdulal And Soumya";
 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 )) ));

// This part will plot the EMA value And type of user choice
 EMAstyle=ParamStyle("MAType",styleLine,maskAll );
LTEMAcolor=ParamColor("LT EMA Colour" ,colorRed);
STEMAcolor=ParamColor("ST EMA Colour",colorGreen);
LTEMAPeriod=Param("LTEMA Period",30);
STEMAPeriod=Param("STEMA Period",13);
Plot(EMA(Close,STEMAPeriod),"EMA of "+STEMAPeriod+" Days" , STEMAcolor, EMAstyle, Null, Null );
Plot(EMA(Close,LTEMAPeriod), "EMA of "+LTEMAPeriod+" Days", LTEMAcolor, EMAstyle, Null, Null );
//Plot(SAR(.02,.2),"SAR",colorBlue,maskAll,Null,Null);

// This part will plot Closing price with barstyle choosen by user
 ChartStyl=ParamStyle("Chart Type", styleBar,maskAll );
Chartcolor=ParamColor("Chart Colour",colorGreen);
Plot(Close,"Debdulal",Chartcolor,ChartStyl);

// This part will find the buy and sell point in the chart
 SellTRIGGER=MACD(12,26)<= Signal(12,26,9);
Buy=Cross(MACD(12,26),Signal(12,26,9));
Sell=(EMA(Close,LTEMAperiod)>EMA(Close,STEMAperiod)) AND SellTRIGGER;
 //Buy= MACD(12,26)>=Signal(12,26,9);
//Sell=MACD(12,26)<Signal(12,26,9);
//Sell=Cross(EMA(Open,Operiod),EMA(Close,Cperiod))AND MACD(12,26)<Signal(12,26,9);

Buy     = ExRem(Buy, Sell);
Sell    = ExRem(Sell, Buy);
Signalshape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes( Signalshape, IIf( Buy, colorBrightGreen, colorRed ),0, IIf( Buy, Low, High ) );
pos = 1.3*ATR(15);
for( i = 0; i < BarCount; i++ ) {
       if( Buy[i] ) PlotText( "Buy\n@" + Close[i], i, Low[i] - pos[i], colorBrightGreen );
       if( Sell[i] ) PlotText( "sell\n@" + Close[i], i, Low[i] + pos[i], colorBlue );
    }
_SECTION_END();