c5[1]應該是要找再前一次條件成立時距離現在K棒的位置,但是結果不是我所想,
看選股結果只是前一天跟後一天的差異,是否barslast有bug。
settotalbar(200); input: Length_D(9, "日KD期間"); input: Length_M(5, "周KD期間"); variable:rsv_d(0),kk_d(0),dd_d(0),c5(0); stochastic(Length_D, 3, 3, rsv_d, kk_d, dd_d); c5=barslast(kk_d crosses over dd_d); if c5=0 and c5[1]>20 then condition1=true; if condition1 then ret =1; outputfield(1,c5); outputfield(2,c5[1]);

1 評論