holun11 發表於 17-10-16 23:12

求助: Types are not compatible

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 > close then
positivers = close - close + close - low and
negativers = high - close;

if close < close then
positivers = close - low and
negativers = close - close + high - close;

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

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

end;

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

easytrader788 發表於 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 > close then begin
positivers = close - close + close - low ; {and}
negativers = high - close;
end ;

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

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

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

end;

// if 判斷式加上 Begin .... end , 拿掉 and
// 或是把 and 換成 ; 也可以編譯
因為 positivers & negativers 宣告為數值變數 , 句子內使用了 and 為邏輯變數, 所以型態不符

holun11 發表於 17-10-17 18:11

現在可以了!感謝你!
頁: [1]
查看完整版本: 求助: Types are not compatible