qqaa222qqww 發表於 21-6-27 19:20

FOR迴圈語法問題

各位大神

想要統計加總一段週期內的"收盤價>中位數及收盤價>昨日收盤價"與"收盤價<中位數及收盤價<昨日收盤價" 次數.

但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 > l_MMI and c > c then
        nhigh = nhigh+1
else       
if c < l_MMI and c < c then
        nlow = nlow+1;
end;

MMI = 100*(nhigh + nlow) / (MMILen-1);

plot1(MMI,"MMI");

print(date,"",time,"",c,"",nhigh,"",nlow,"",l_MMI,"",j,"");

//---------------------------------------------------------------------------------------------------------------------------------------------------------





limin 發表於 21-6-28 03:13

會不會是nhigh = nhigh+1 少加了 ; 結尾
頁: [1]
查看完整版本: FOR迴圈語法問題