|
各位大神
想要統計加總一段週期內的 "收盤價>中位數及收盤價>昨日收盤價" 與 "收盤價<中位數及收盤價<昨日收盤價" 次數.
但print出來是錯誤的,正確是要跟excel的圖一樣.
程式碼是哪邊寫錯了?? 還請各位大神指教.
程式碼如下
//---------------------------------------------------------------------------------------------------------------------------------------------------------
inputs:MMILen( 5 );
variables:l_MMI(0),MMI(0),nlow(0),nhigh(0),j(0);
l_MMI = Median(C,MMILen);
nhigh = 0;
nlow = 0;
for j=0 to MMILen-1 begin
if c[j] > l_MMI and c[j] > c[j+1] then
nhigh = nhigh+1
else
if c[j] < l_MMI and c[j] < c[j+1] then
nlow = nlow+1;
end;
MMI = 100*(nhigh + nlow) / (MMILen-1);
plot1(MMI,"MMI");
print(date," ",time," ",c," ",nhigh," ",nlow," ",l_MMI," ",j," ");
//---------------------------------------------------------------------------------------------------------------------------------------------------------
|
-
excel
-
mc_print
|