Showing posts with label AFL for delivery based trading. Show all posts
Showing posts with label AFL for delivery based trading. Show all posts

Sunday, 9 March 2014

Amibroker AFL with Buy Sell Signals


















I am posting another AFL, which can be useful to plan your trades. This AFL is particularly useful for traders who do swing trading. In swing trading the trader prefers to wait for a trading signal based on confirmed change of trend. This signal can take short to long trading days. In this trading system a trader can safely find an entry point, but waiting for an exit signal can take away some of the gains generated.

Most analyst advice, whenever a trade is entered, the exit point too must be decided based on some criteria. These criteria can be anything from percentage of return to specific price target.

What this AFL attempts to do is it gives an entry point along with a target price to wait for an exit. It also cautions the trader, with a stop loss level. The back ground color can be adjusted to suit the viewing comfort. The chart window also displays a trending ribbon, which serves as a trend indicator. The time frame can be adjusted for daily, weekly or monthly. In every time frame chosen, the entry and the exit points can vary. My opinion is to look for a weekly mode setting, which can give a meaningful value. A word of caution here – deploy this AFL along with other indicators for confirmation of trends. I suggest, the Stochastic Momentum Index for confirmation. I have tweaked the codes slightly to avoid booking profits too early.

Please back test this AFL before taking a call.
The AFL can be downloaded free from here

Happy trading and best wishes.

Saturday, 21 September 2013

Stockastic Momentum Index AFL

I have given below an indicator which can be of great use both for intraday traders and delivery based traders. this indicator will tell us the current strength of a given stock. When the indicator crosses 60 levels and takes a slight turn downwards, we can expect the stock to lose its value. one can short it or sell the stock if  already bought.Similarly when the indicator below the -60 levels and shows an upward trend, it is and indication  that the stock is gaining strength. one can buy it  on the long side.

It would be advisable to use this along with other indicators for confirmation, because relying on one indicator is not always good. 

I hope you will enjoy using the Stochastic Momentum Index AFL 


////////////////////////////////////// the code begins below this line/////////////////////////////////////////

SECTION_BEGIN("SMI - Stochastic Momentum Index");
SetChartBkColor( colorBlack ) ;
LookBack    = Optimize("LookBack",Param("Lookback", 10, 1, 100 ),1,30,1);
Smooth1     = Optimize("Smooth 1",Param("Smooth 1", 3, 1, 100 ),1,30,1);
Smooth2     = Param("Smooth 2", 3, 1, 20 );
Trigger     = Param("Signal", 3, 1, 10);
PP            = ParamField("Price field",-1);
SMILevel    = Param("Level", 60, 10, 60, 10);

HH = HHV( H, LookBack );
LL = LLV( L, LookBack );


StoMom = 100 * EMA( EMA( PP - 0.5 * ( HH + LL ), Smooth1 ), Smooth2 ) /
( 0.5 * EMA( EMA( HH - LL, Smooth1 ), Smooth2 ) );
StoSig = MA(StoMom,3);

Buy = Cover = Cross(StoMom,StoSig);
Short = Short = Cross(StoSig,StoMom);

Plot (StoMom,_DEFAULT_NAME(),IIf(StoMom> Ref(StoMom,-1),colorBrightGreen,colorRed), styleLine+styleThick);
Plot (StoSig,"",colorWhite,styleLine+styleNoLabel);
Plot(0,"",31,styleNoLabel);
Plot( SMILevel,"",colorOrange,styleDashed);
Plot(-SMILevel,"",colorOrange,styleDashed); 

Monday, 9 September 2013

Amibroker AFL for positional trading


Today I am posting another AFL for the benefit of delivery based traders. This AFL can indicate or make sure you are on the safer side of the market. When this AFL is plotted one can observe colored dots appearing at the end of a trend. The white dot alerts us that new high or new lows are being formed. One can use this alert to exit with profit or enter short. The red dot signals a ongoing downtrend. Similarly a green dot tells us that the uptrend is intact.

There are two lines indicating MA High and Low. if these lines are plotted on a weekly chart one can have a better understanding of the stock in question. If the stock price moves down touching the Lower line and forms a green dot this is certainly a good buy for a medium term, say 2 or 3 weeks. when the stock price moves well above the upper line continues to give red dots as alerts, it safe to book your profits.

I am not the creator of this AFL, therefore the credit goes to the original creator of this trading system.

 /////////////////Copy the code below this line and past in the formula editor, name it and save it under the custom folder ////////////////////////////////////////////////////////

_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() );
mH    =    MA(H, 20);        mL    =    MA(L, 20);

Plot(mH ,"MA-H", IIf(mH > Ref(mH,-1), colorBlue,colorRed), styleThick);
Plot(mL ,"MA-L", IIf(mL > Ref(mL,-1), colorBlue,colorRed), styleThick);

Lx=LastValue(x=BarIndex());
pk=H>Ref(HHV(H,5),-1) AND Ref(HHV(H,5),5)<=H;
tr=L<Ref(LLV(L,5),-1) AND Ref(LLV(L,5),5)>=L;
PlotShapes(shapeSmallCircle*tr, IIf(Lx-ValueWhen(tr,x)>=5,colorBrightGreen,colorWhite),0,round(L*0.999),0);
PlotShapes(shapeSmallCircle*pk, IIf(Lx-ValueWhen(pk,x)>=5,colorOrange,colorWhite),0,round(H*1.001),0);
_SECTION_END();
 ////////////////////////////////////////////////////////
Happy trading !!