Saturday 30 August 2014

A AFL For Amibroker : Volume Adjusted Momentum

A AFL For Amibroker : Volume Adjusted Momentum   Like This ...




_SECTION_BEGIN(" ATR & Volume Adjusted Momentum");

SetChartBkColor(colorBlack);

p1=Param("First period",5,2,14,1);
p2=Param("Second Period",30,14,60,1);
momp=Param("Momentum Period",5,3,14,1);

Mtm = (C - Ref (C, -momp ))/ATR(momp);/// changed
AbsMtm = (abs ( mtm)+ abs(V-Ref(V,-momp))); //changed
///===============================================
Num_E = EMA ( EMA ( Mtm, P1 ), P2 );//changed
Den_E = EMA ( EMA ( AbsMtm, P1 ), p2 );//changed
///===============================================
Bensu = 100 * Nz ( Num_E / Den_E);


AA1=C/Ref(C,-8)*100;
AA2=C/Ref(C,-13)*100;
AA3=C/Ref(C,-21)*100;
a1=EMA(AA1,1);
a2=EMA(AA2,1);
a3=EMA(AA3,1);
b1=StDev(a1,8);
b2=StDev(a2,13);
b3=StDev(a3,21);
RMOV=((a1*b1)+(a2*b2)+(a3*b3))/(b1+b2+b3);
KK=EMA(EMA(RMOV,3),3);
_SECTION_END();

_SECTION_BEGIN("");



upcolor=ParamColor("UpCandleColor",colorBlack );
downcolor=ParamColor("DownCandleColor",colorBlack );



Volwma=WMA(Bensu,13);
Volchange=(((Bensu-Volwma)/Volwma)*100);
Vol=(ROC(Bensu,1));


GraphXSpace = Param("Xspace", 10, 2, 20, 1);

LBP = Param("Look Back", 15, 0, 150,1 );
Mean = MA(ln(Bensu),LBP);
StD = StDev(ln(Bensu),LBP);
xp3 = exp(mean + 2*std); //3 band
xp2 = exp(mean + 1.5*std); //2 nd band
xp1 = exp(mean + 1*std); // 1st band
xm = exp(mean); // avg
xn1 = exp(mean - 1*std); // -1 band
xn2 = exp(mean - 1.5*std); //-2 band
VolColor=IIf(KK>100,colorGold,colorCustom11);
Plot(Volwma, "Otithi Lozz", VolColor,ParamStyle("AvgStyle",styleLine|styleThick|styleDots,maskAll),1|4096);


Plot(xn1,"",colorBlue,1|4096);
Plot(xn2,"", 1,1|4096);

upbar = Bensu > Ref(Bensu,-1);
downbar = Bensu< Ref(Bensu,-1);
barcolor2=IIf(downbar,colorRed, IIf(upbar, 2,19) );

upbar = Bensu > Ref(Bensu,-1);
downbar =Bensu< Ref(Bensu,-1);

O = IIf(downbar, Bensu, 0);
C = IIf(downbar, 0,Bensu);
L=0;
H = Bensu;

ColorHighliter = IIf(upbar, upcolor,IIf(downbar, downcolor,colorDarkGreen));

pds = 10;
V1 = Bensu/MA(Bensu,13); V2 = Bensu/MA(Bensu,21);
V3 = Bensu/MA(Bensu,34);

barcolor = IIf(Bensu<MA(Bensu,pds),colorRed,colorWhite );
SetBarFillColor( barcolor );
PlotOHLC( O,H,L,C, "", barColor2, ParamStyle("CandleStyle",styleCandle,maskAll));


_SECTION_END();

_SECTION_BEGIN("Centered-StochRSI Line");
x=(( RSI(21) - LLV(RSI(21) ,21)) / ((HHV(RSI(21 ) ,21)) - LLV(RSI(21),21)))*100;
Value1=0.1*((x)-50);
Value2=WMA(Value1,7);
KK4=(exp(Value2)-1)/(exp(Value2)+1);

Plot(0,"",IIf(EMA(KK4,3)>0.50,colorBrightGreen,colorRed) ,4+styleNoLabel);
_SECTION_END();

2 comments:

  1. Good post.
    Can you provide me a tutorial for import csv file in Amibroker? I follow stock Bangladesh plugin but can not import last 5/6 years data to ami broker.

    ReplyDelete
  2. http://www.stockbangladesh.com/resources/amibrokerplugin



    Procedure:

    Step 1: Registration for Ami Broker Data Plugin.

    Step 2: Download Ami Broker Data Plugin.

    Step 3: Please extract the downloaded file. A new folder will be created named "sbplugin_1.05". In this folder you have to run the EXE file named "Stockbangladesh.EXE".

    Step 4: Use Amibroker version 5.2 or above for better result.

    Step 5: To know more about the installation, you can Download Manual for SBPlugin.

    ReplyDelete

Thanks