Reply To: รบกวนขอสูตรทั้งหมดสำหรับ Amibroker ครับ

#24360
dreamscat
Keymaster

CDC Actionzone 170101 for Amibroker.afl

///////////////////////////
// CDC Actionzone 170101 //
// Amibroker Edition //
// Converted 17/01/2017 //
///////////////////////////

_N( Title = StrFormat( “{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol ” + WriteVal( V, 1.0 ) + ” {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );

src = ParamField(“Data Source”,3);

sprd = Optimize(“Slow MA”,26,15,50,1);
fprd = Optimize(“Fast Period”,0.3,0.1,0.6,0.05)*sprd;

fast = EMA(src,fprd);
slow = EMA(src,sprd);
macdv = fast-slow;
sig = MA(macdv,9);

Bullish = macdv>0;
Bearish = macdv<0;

Green = Bullish AND src>fast;
Yellow = Bullish AND src<fast AND src>slow;
Brown = Bullish AND src<fast AND src<slow;

Red = Bearish AND src<fast;
Aqua = Bearish AND src>fast AND src<slow;
Blue = Bearish AND src>fast AND src>slow;

buysig = Bullish AND Ref(Bearish,-1);
PreBuy = Blue AND Ref(Blue,-1) AND Ref(Blue,-2) AND Ref(Blue,-3) AND src<Ref(src,-2);
BuyMore=BarsSince(Bullish)<26 AND Yellow AND src=LLV(src,9);

sellsig = Bearish AND Ref(Bullish,-1);
PreSell=Yellow AND BarsSince(buysig)>25 AND src<Ref(src,-2);
SellMore=Yellow AND BarsSince(Yellow)>2 AND src<Ref(src,-2);

//Plot(sig,”Signal Line”,colorBlue,styleLine);
//SetGradientFill(colorLime,colorRed,0,GetChartBkColor());
//Plot(macdv,”MACD”,colorGrey50,styleGradient);

plotcolor = IIf(Green,colorGreen,IIf(Yellow,colorYellow,iif(Brown,colorBrown,iif(Red,colorRed,iif(Aqua,colorAqua,iif(Blue,colorBlue,colorWhite))))));

Plot(c,”Price”,plotcolor,styleCandle);
Plot(fast,”Fast EMA”,colorRed,styleDashed);
Plot(slow,”Slow EMA”,colorBlueGrey,styleDashed);
PlotOHLC(fast,fast,slow,slow,”2ma zone”,IIf(fast>slow,ColorBlend(colorGreen,GetChartBkColor()),ColorBlend(colorRed,GetChartBkColor())),styleCloud);

// Exploration //

pctchange = ((C-Ref(C,-1))/Ref(C,-1))*100;
Filter = pctchange;
AddColumn(C,”Close”);
AddColumn(buysig,”Buy”);
AddColumn(prebuy,”PreBuy”);
AddColumn(BuyMore,”Buy More”);
AddColumn(sellsig,”Sell”);
AddColumn(PreSell,”PreSell”);
AddColumn(SellMore,”Sell More”);
AddColumn(pctchange,”Percent Change”);

// Quick Scan //
Buy = buysig;
Sell = sellsig;

// System Test //
// DO NOT FORGET TO EDIT THIS PART TO FIT YOUR SYSTEM TEST SETTINGS!! //

maxpos = 500;

SetPositionSize(100/maxpos,spsPercentOfEquity);
SetOption(“InitialEquity”, 1000000);
SetOption(“AllowPositionShrinking”, True);
SetOption(“MaxOpenPositions”,maxpos);