//value2 = RSV, value3 = K, value4 = D
value1 = Stochastic(9,3,3,value2,value3,value4);
// K, D 都大於70且KD死叉
if value3 > 70 and value4 > 70 and value3 cross over value4
then setposition(-1);
//停損停利
input: profit_point(10, "停利(點)");
input: loss_point(10, "停損(點)");
if Position = -1 and Filled = -1 then begin;
if profit_point < 15 then begin;
SetPosition(0);
end else if loss_point > 18 and Close >= FilledAvgPrice + loss_point then begin;
SetPosition(0);
剛入門,寫一個台指期空單策略,想寫成:
停利:成本價-15就停利
停損:收盤價>成本價+18就市價停損
我按編譯會說最後一行有少東西
但如果只有這樣就編譯完成
//value2 = RSV, value3 = K, value4 = D
value1 = Stochastic(9,3,3,value2,value3,value4);
//停損停利
input: profit_point(10, "停利(點)");
input: loss_point(10, "停損(點)");
// K, D 都大於70且KD死叉
if value3 > 70 and value4 > 70 and value3 cross over value4
then setposition(-1);
不知道哪裡出問題,求指導,非常感謝!!
1 評論