學習中...多條件問題
inputs:Price( Close ), Length( 14 ), OverSold( 0 ), OverSold2( 0 ) , OverSold3( 0 ), OverSold4( 0 ) ;variables:var0( 0 ), var1(0), var2(0), var3(0);
var0 = RSI( Price, Length ) ;
condition1 = Currentbar > 1 and var0 cross over OverSold;
condition2 = Currentbar > 1 and var0 cross over OverSold2 ;
condition3 = Currentbar > 1 and var0 cross over OverSold3 ;
condition4 = Currentbar > 1 and var0 cross over OverSold4 ;
if condition1 or condition2 or condition3 or condition4 then Buy ( "buy" ) next bar at market ;
if var0 < var0 then sell ( "sell" ) next bar at market ;
想加個條件 是(XAverage(c,20) 在c,50以上 ,c,50在c,100以上) 才執行condition1-4
我用if xxx then begin做不到請教一下(上網也看過 寫不出來....)
condition4 更改為:
condition4 = (Currentbar > 1 and var0 cross over OverSold4 ) and (XAverage(c,20) > XAverage(c,50)) and (XAverage(c,50)>XAverage(c,100))
可以請教樓主為什麼用 if xxx then begin 做不到嗎?
會有什麼問題呢? 學習中,一直看,一直試,那天再上台請益。 謝謝各位大大的分享,新手
多看一些不同的情境,各種條件的選擇
也許目前還不太會寫,但以後,可能可以拿來參考發想成其他判斷式。
頁:
[1]