Thứ năm, 08/04/2021 | 17:17 GMT+7
Lập trình cơ bản Amibroker - Afl - Bài 01
Bài này trình bày cách lập trình cơ bản nhất với Amibroker, chiến lược căn bản kiểu Hello world!CODE AFL đơn giản
_SECTION_BEGIN("MACD"); _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()); ma1 = MA(C,10); ma2 = EMA(C,10); Buy = Cross(ma2,ma1); Sell = 0; Plot(ma1,"MA1", colorBlue); Plot(ma2,"MA2", colorRed); //Plot shape at default position //PlotShapes( Buy * shapeUpArrow, colorBlue); //Plot shape at Low, easy see PlotShapes( Buy, colorBlue, 0, Low); //Take profit: 2% ApplyStop(stopTypeProfit,stopModePercent,2,True); //Stop lost: 1% ApplyStop(stopTypeLoss,stopModePercent,1,True); ////For explore /// Filter= Buy; AddColumn(IIf(Buy,66,Null),"Signal" , formatChar); _SECTION_END();
DOWNLOAD DATA FILE:
DATA FILE
Xem Cách Import Dữ liệu mẫu vào Amibroker
Các tin trước
Code So ví dụ tương đương Tradingview - Pine Script và Amibroker - Afl 2021-03-13