_SECTION_BEGIN("Compare 2 Stocks");
Ticker = ParamStr("Symbol", "VN30" );
//upcol = Foreign(Ticker,"Close") - Ref(Foreign(Ticker,"Close"),-1);
//kol = IIf(upcol > 0, colorGreen, colorRed);
Gap = Close - Foreign(Ticker,"Close"); Gcolor = IIf(gap>0,colorGreen,colorRed);
Gap2 = (Gap / Foreign(Ticker,"Close")) *100;
//PlotOHLC(Foreign(Ticker,"Open"), Foreign(Ticker,"High"), Foreign(Ticker,"Low"), Foreign(Ticker,"Close"),"Ticker", colorRed, ParamStyle("Style", styleLine)|styleOwnScale);
Plot(Foreign(Ticker,"Close"),"Ticker",ParamColor("Symbol Color", colorBlue),ParamStyle("Symbol Style", styleLine) );
//UpClose = Close - Ref(Close,-1);
//Color = IIf(UpClose > 0, colorGreen, colorRed);
//PlotOHLC(Open,High,Low,Close,"", colorLime, ParamStyle("style",styleLine) );
Plot(Close, Name(), IIf(Gap>0,ParamColor("Higher color",colorLime),ParamColor("Lower color",colorRed)),ParamStyle("Style",styleLine | styleThick));
Plot(Gap, "Gap",Gcolor, styleHistogram | ParamStyle ("Gap Style", styleHistogram | styleOwnScale , maskHistogram ), 2);
Title = " Compare 2 Stocks - " + " Date: " + Date() + EncodeColor(colorLightGrey) +
WriteIf(Gap>0, encodecolor(colorLime) + " - Chenh lech: " + WriteVal(Gap,1.2) + " (" + WriteVal(Gap2,1.2) + "%)",
encodecolor(colorRed) + " - Chenh lech: " + WriteVal(Gap,1.2) + " (" + WriteVal(Gap2,1.2) + "%)" ) + "\n" +
EncodeColor(colorLime) + Name() + " - O: " + O + " - H: " + H + " - L: " + L + " - C: " + C + "\n" +
EncodeColor(colorBlue) + Ticker + " - O: " + Foreign(Ticker,"Open") + " - H: " + Foreign(Ticker,"High") + " - L: " + Foreign(Ticker,"Low")+ " - C: " + Foreign(Ticker,"Close");
//SetChartBkGradientFill( ParamColor("Top Colour", colorBlack),ParamColor("Bottom Colour", colorBlack));
_SECTION_END();
👉Tải tại đây
https://drive.google.com/file/d/1GQH0E5u4rWF8A8DaKV5tNDyh_7OqgB6k/view?usp=drive_link
Cách sử dụng AFL cho Amibroker
Tải xuống tệp Amibroker AFL.
Bây giờ hãy sao chép tệp afl và dán vào vị trí cài Amibroker
D:\A KY PC\Win\Amibroker\Formulas\VIP free