把四個條件同時符合 跳警示訊號 以下語法應該如何修正

  •   311 
  • 最後發表   小豪很仁慈  2025 三月 03
小豪很仁慈 發文於   2025/02/25

用策略雷達跑以下程式碼  ,使用在5分頻率,開逐筆洗價 我想要的效果是全條件符合 跳警示訊號

但是執行下去卻變成 單一條件就會跳 請問以下語法應該如何修正

if date <> date[1] then begin

condition1 = False;

condition2 = False;

condition3 = False;

condition4 = False;

end;

 

if Value3 > number

then begin

condition1 = True;

end;

 

if value8 >= number1

then begin

condition2 = True;

end;

 

if value14 >= number3

then begin

condition3 = True;

end;

 

if close >= number4

then begin

condition4 = True;

end;

 

if condition1 and condition2 and condition3 and condition4

then ret=1;

排序方式: 標準 | 最新
虎科大許教授 發文於   2025/02/25

問題出在一旦這4個condition變為True之後,盤中就沒有機會變成False。把4個condition都比照以下方式修改:

if Value3 > number then condition1 = True else condition1 = false;

 

小豪很仁慈 發文於   2025/02/26

好的,謝謝許教授解答

XS小編 發文於   2025/03/03

Hello 小豪很仁慈,

 

小編補充,如果腳本每次計算都要判別條件是否符合的話,那麼只要用 condition1 = Value3 > number; 這種寫法就可以了。

發表回覆
Close