if and or 羅輯運算子使用的問題

  •   1.2K 
  • 最後發表   JK1234  2020 一月 09
JK1234 發文於   2020/01/06

我的問題是 寫法A是哪裡有問題? 是我理解錯 if and or 的用法?

我要用寫法A 找到 寫法B+寫法C 共80檔

 寫法 A找到217檔,因為沒有過濾掉成交張數少的

===========================

if high >= highest(high,10)

or high <= highest(high,10) * 0.995

and high*0.98>=close

and average(volume,10)>=800

and volume[1]*close>=145000

then ret=1;

 ===========================

寫法 B(9) 找到9檔,有過濾掉成交張數少的

if high >= highest(high,10)

and high*0.98>=close

and average(volume,10)>=800

and volume[1]*close>=145000

then ret=1;

 ===========================

寫法 C(71) 找到71檔,有過濾掉成交張數少的

if high <= highest(high,10) * 0.995

and high*0.98>=close

and average(volume,10)>=800

and volume[1]*close>=145000

then ret=1;

XQ小幫手 發文於   2020/01/09

Hi JK1234

您好,依照判斷邏輯,只要將A段語法or的地方+個括弧就可以囉~

if (high >= highest(high,10)

or high <= highest(high,10) * 0.995)

and high*0.98>=close

and average(volume,10)>=800

and volume[1]*close>=145000

then ret=1;

小幫手有測試過,答案就會正確囉

以上說明,謝謝。

發表回覆
Close