AFL for Amibroker
===========================================
_SECTION_BEGIN("BACKGROUD LTRS");
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetOverlayMode(1);
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxSelectFont("Tahoma", Status("pxheight")/12);
GfxTextOut( "PRASAD ANALYTICS ©", Status("pxwidth")/2, Status("pxheight")/14);
GfxSelectFont("Tahoma", Status("pxheight")/9 );
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/4.1 );
GfxSelectFont("Arial Narrow", Status("pxheight")/28 );
GfxTextOut( "prasad9rao@gmail.com", Status("pxwidth")/2, Status("pxheight")/1.5);
GfxSelectFont("arial narrow", Status("pxheight")/27 );
GfxTextOut( "Dedicated to MY FATHER : BALKRISHNA RAO", Status("pxwidth")/2, Status("pxheight")/1.15);
_SECTION_END();
k = (GetPerformanceCounter()/100)%256;
printf("GetPerformance Counter %g",k);
GfxSelectFont("Arial Narrow", 10,700 );
GfxSetBkMode(1);
GfxSetTextColor(colorYellow);
//GfxTextOut("Dedicated to the loving memory of MY FATHER",100+k ,26);
RequestTimedRefresh(1);
_SECTION_END();
PeriodS = Param("Short period", 12, 1, 500 );
PeriodL = Param("Long period", 26, 2, 501 );
PeriodSig = Param("Smoothing period", 9, 1, 200 );
LongMA = EMA( V * C, PeriodL ) / EMA( V, PeriodL );
ShortMA = EMA( V * C, PeriodS ) / EMA( V, PeriodS );
VMACD = ShortMA - LongMA;
SignalLine = EMA( VMACD, PeriodSig );
HIST = VMACD-SignalLine;
//Uncomment two lines below to see also MACD and signal line
Plot( VMACD, "Vol-weighted MACD", colorDarkRed );
Plot( SignalLine, "Vol-weighted Signal", colorWhite);
Plot( VMACD-SignalLine, "VMACD Histogram", colorGold, styleHistogram );
RATEADOFMACDCHANGE = (HIST - Ref(HIST,-1)) ;
GfxSetTextAlign( TA_left = 0);
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(209,191,255));
GfxTextOut("PRASAD ANALYTICS - VWMACD",07, 0);
GfxSetTextAlign( TA_LEFT = 0 );
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(255,180,61));
GfxTextOut(Name()+ " " + Date(),07,30);
GfxSetTextColor(ColorRGB(109,101,255));
GfxTextOut("VWMACD["+PeriodS+" ]"+"["+PeriodL+"]" + "["+PeriodSig+"]",07, 14);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("Signal =" + NumToStr(SignalLine,1.2),255, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("VMACD =" + NumToStr(VMACD,1.2),375, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("Hist =" + NumToStr(VMACD-SignalLine,1.2),500, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("rATE OF cHANGE =" + NumToStr(RATEADOFMACDCHANGE,1.2),650, 0);
Title = " ";
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetOverlayMode(1);
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxSelectFont("Tahoma", Status("pxheight")/12);
GfxTextOut( "PRASAD ANALYTICS ©", Status("pxwidth")/2, Status("pxheight")/14);
GfxSelectFont("Tahoma", Status("pxheight")/9 );
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/4.1 );
GfxSelectFont("Arial Narrow", Status("pxheight")/28 );
GfxTextOut( "prasad9rao@gmail.com", Status("pxwidth")/2, Status("pxheight")/1.5);
GfxSelectFont("arial narrow", Status("pxheight")/27 );
GfxTextOut( "Dedicated to MY FATHER : BALKRISHNA RAO", Status("pxwidth")/2, Status("pxheight")/1.15);
_SECTION_END();
k = (GetPerformanceCounter()/100)%256;
printf("GetPerformance Counter %g",k);
GfxSelectFont("Arial Narrow", 10,700 );
GfxSetBkMode(1);
GfxSetTextColor(colorYellow);
//GfxTextOut("Dedicated to the loving memory of MY FATHER",100+k ,26);
RequestTimedRefresh(1);
_SECTION_END();
PeriodS = Param("Short period", 12, 1, 500 );
PeriodL = Param("Long period", 26, 2, 501 );
PeriodSig = Param("Smoothing period", 9, 1, 200 );
LongMA = EMA( V * C, PeriodL ) / EMA( V, PeriodL );
ShortMA = EMA( V * C, PeriodS ) / EMA( V, PeriodS );
VMACD = ShortMA - LongMA;
SignalLine = EMA( VMACD, PeriodSig );
HIST = VMACD-SignalLine;
//Uncomment two lines below to see also MACD and signal line
Plot( VMACD, "Vol-weighted MACD", colorDarkRed );
Plot( SignalLine, "Vol-weighted Signal", colorWhite);
Plot( VMACD-SignalLine, "VMACD Histogram", colorGold, styleHistogram );
RATEADOFMACDCHANGE = (HIST - Ref(HIST,-1)) ;
GfxSetTextAlign( TA_left = 0);
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(209,191,255));
GfxTextOut("PRASAD ANALYTICS - VWMACD",07, 0);
GfxSetTextAlign( TA_LEFT = 0 );
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(255,180,61));
GfxTextOut(Name()+ " " + Date(),07,30);
GfxSetTextColor(ColorRGB(109,101,255));
GfxTextOut("VWMACD["+PeriodS+" ]"+"["+PeriodL+"]" + "["+PeriodSig+"]",07, 14);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("Signal =" + NumToStr(SignalLine,1.2),255, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("VMACD =" + NumToStr(VMACD,1.2),375, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("Hist =" + NumToStr(VMACD-SignalLine,1.2),500, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("rATE OF cHANGE =" + NumToStr(RATEADOFMACDCHANGE,1.2),650, 0);
Title = " ";
hello sir i am unable to back test. in amibroker it is saying Error 701. Missing buy/sell variable assignments.
ReplyDeleteThe formula that you are trying to backtest does not contain proper Buy and Sell rules. Buy and Sell rules should be written as assignments as shown below:
Buy = Cross( Close, MA( Close, 50 ) );
Sell = Cross( MA( Close, 50 ), Close ) );
so please add buy and sell and short and cover afl . thankz sir
DeleteI like your site and very nic Post.....!!!!
ReplyDeletebuy sell indicators
Thanks for sharing nice Information for Commodity trading . There is a lot of important information on your site
ReplyDeletereal time stock BUY SELL
It's very Nice, Thanks for sharing a valuable information....
ReplyDeletelarsentoubro
laxmi motors
motherson sumi buy or sell
bf utilities target
larsentoubro
hindustan zinc stock recommendation
muthoot finance
anantraj share price