老師 請幫忙改一下,圖表交易的轉(zhuǎn)化為后臺交易的,應(yīng)該修改編寫
DIFF := EMA(CLOSE,360) - EMA(CLOSE,1440);
DEA := EMA(DIFF,160);
macd_M5:= 2*(DIFF-DEA);
MA1:MA(C,60),COLORRED;
S:= ABS(MA1-H)<=12*mindiff;
n:=10;//加倉次數(shù)
x:=3;//建倉手?jǐn)?shù)
w:=5;
kong:=S and macd_m5<0 ;
if kong then buyshort(holding=0,x,market);
if kong and ENTERPRICE-C>=w*MINDIFF and abs(holding)=x then buyshort(1,x,market);
if kong and ENTERPRICE-C>=w*MINDIFF and abs(holding)=2*x then buyshort(1,x,market);
if kong and ENTERPRICE-C>=w*MINDIFF and abs(holding)=3*x then buyshort(1,x,market);
if kong and ENTERPRICE-C>=w*MINDIFF and abs(holding)=4*x then buyshort(1,x,market);
if kong and ENTERPRICE-C>=w*MINDIFF and abs(holding)=5*x then buyshort(1,x,market);
if macd_m5>0 and holding<0 then sellshort(1,0,market);//平空
前面的不變,后面的修改如下:
if kong then tbuyshort(tholding=0,x,mkt);
if kong and tENTERPRICE-C>=w*MINDIFF and abs(tholding)=x then tbuyshort(1,x,mkt);
if kong and tENTERPRICE-C>=w*MINDIFF and abs(tholding)=2*x then tbuyshort(1,x,mkt);
if kong and tENTERPRICE-C>=w*MINDIFF and abs(tholding)=3*x then tbuyshort(1,x,mkt);
if kong and tENTERPRICE-C>=w*MINDIFF and abs(tholding)=4*x then tbuyshort(1,x,mkt);
if kong and tENTERPRICE-C>=w*MINDIFF and abs(tholding)=5*x then tbuyshort(1,x,mkt);
if macd_m5>0 and tholding<0 then tsellshort(1,0,mkt);//平空