COCO研究院

 找回密碼
 註冊
搜索
查看: 3366|回復: 2

求助: Types are not compatible

[複製鏈接]
發表於 17-10-16 23:12 | 顯示全部樓層 |閱讀模式
inputs:
        Len(NumericSimple);
               
variable: x(0), positivers(0), negativers(0), RS(0), NRSI(0);

rs = 0;
positivers = 0;
negativers = 0;

For x = 0 to Len - 1 begin
if close[x] > close[x+1] then
positivers = close[x] - close[x+1] + close[x] - low[x] and
negativers = high[x] - close[x];

if close[x] < close[x+1] then
positivers = close[x] - low[x] and
negativers = close[x+1] - close[x] + high[x] - close[x];

RS = average(+rs,14)/average(-rs,14);

NRSI = 100-(100/(1+RS));

end;

在positivers和negativers出現Types are not compatible的情況,有人知道如何處理嗎? 感謝!

發表於 17-10-17 14:12 | 顯示全部樓層
inputs:
        Len(NumericSimple);
               
variable: x(0), positivers(0), negativers(0), RS(0), NRSI(0);

rs = 0;
positivers = 0;
negativers = 0;

For x = 0 to Len - 1 begin
if close[x] > close[x+1] then begin
positivers = close[x] - close[x+1] + close[x] - low[x] ; {and}
negativers = high[x] - close[x];
end ;

if close[x] < close[x+1] then {begin}
positivers = close[x] - low[x] ; {and}
negativers = close[x+1] - close[x] + high[x] - close[x];
end ;

RS = average(+rs,14)/average(-rs,14);

NRSI = 100-(100/(1+RS));

end;

// if 判斷式加上 Begin .... end , 拿掉 and  
// 或是把 and 換成 ; 也可以編譯
因為 positivers & negativers 宣告為數值變數 , 句子內使用了 and 為邏輯變數, 所以型態不符
 樓主| 發表於 17-10-17 18:11 | 顯示全部樓層
現在可以了!感謝你!
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-25 11:31

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |