本帖最後由 ilpir 於 10-6-26 10:46 AM 編輯
thelastlaugher,已經回答了.就是用macd<0 macd>-50
交易次數用設一個k來判斷.
每賣一次,k增加1,當k小於n時才做賣出~
當平倉或其它條件再把k歸0.
Inputs: FastMA(12), SlowMA(26), MacdMA(9),n(1);
vars:k(0);
value1= MACD(Close, FastMA, SlowMA);
value2=XAverage(MACD(Close, FastMA, SlowMA), MacdMA);
value3=value1 - value2;
if value3<0 and value3>-50 and k<=n then begin
sell next bar at market;
k=k+1;
end; |