|
input:long(26,20,100),short(12,5,40),m(9,2,60); wtj1:=datediff(ref(date,1),date)<>weekday-ref(weekday,1); wtj:=refx(wtj1,1); //周末標(biāo)記 fc:=close; diff[1]:0; dea[1]:0; d1:=0;d2:=0; for i=2 to datacount do begin if wtj[i] then begin d1:=(2*fc[i]+(short-1)*d1)/(short+1); d2:=(2*fc[i]+(long-1)*d2)/(long+1); wdiff:=d1-d2; wdea:=(2*wdiff+(m-1)*wdea)/(m+1); diff[i]:=wdiff; dea[i]:=wdea; end else begin diff[i]:=(2*fc[i]+(short-1)*d1)/(short+1)- (2*fc[i]+(long-1)*d2)/(long+1); dea[i]:=(2*wdiff+(m-1)*wdea)/(m+1); end; end; macd:2*(diff-dea),colorstick; |
|
|