kawingshiu 發表於 17-4-20 06:03

請教各位if出現K線A然後下條K線是B then 買入的寫法

各位大大,想請教if出現K線A然後下條K線是Bthen 買入的寫法

haruttn 發表於 17-4-20 09:42

請善用

ex1:
c ==> 表示2根K棒前的收盤價

ex2:(以空頭吞噬為例)

if c<o and c>o and
   (o>=c and c<o) or (o>c and c<=o) then
   sell next bar market;

kawingshiu 發表於 17-4-20 14:37

如果第一根K線是if sgb and close>0 thenplotpb(h,l,"x",rgb(153,153,153))然後下一根K線是if sgb and close>1 thenplotpb(h,l,"x",rgb(153,153,153))應該怎樣寫

easytrader788 發表於 17-4-20 19:36

假設是要根據 Close > n 的方式來畫 K棒,由於先使用了 Close > 0 , 因此下一根 Close > 1 的條件都不會被執行, 可以改成

if sgb then begin
   ifclose > 1then plotpb(h,l,"x",rgb(153,153,153)){ 處理大於 1的狀況 }
       else if close > 0 then plotpb(h,l,"x",rgb(153,153,153)); { 處理 0~ 1 間的狀況 }
end ;

kawingshiu 發表於 17-4-20 23:25

因為用了太多THEN,所以最後想請問怎樣加THEN BUY("BUY") next bar at market;?

jinace 發表於 17-4-21 10:35

var:conditionA(false),conditionB(false);

conditionA=close>close;
conditionB=close>close;

if conditionA and conditionB then
        buy next bar at market;

easytrader788 發表於 17-4-21 11:37

把plotpb這裡換成買賣指令即可

kawingshiu123 發表於 17-4-26 14:30

如果第一根K線是if sgbthenplotpb(h,l,"x",rgb(153,153,153))然後下一根K線是if sgcthenplotpb(h,l,"x",rgb(153,153,153))應該怎樣寫
頁: [1]
查看完整版本: 請教各位if出現K線A然後下條K線是B then 買入的寫法