你好,想請問出場的部分
出場分為三個
1.26點停損
2.62點獲利平倉一口
3.跌破均線全部平倉
因看回測並沒有執行到停損這部分
想請教哪邊需要修改
謝謝~~
----------------------------------------------------------------------------------------------------------
// 宣告參數
input: shortlength(20,"短期均線期數"), Longlength(55,"長期均線期數");
variable: Longaverage(0), shortaverage(0);
input: loss_point(26, "停損(點)");
input: profit_point(62, "停利(點)");
// 資料讀取筆數設定
settotalbar(3);
setbarback(maxlist(shortlength,Longlength));
Longaverage = Average(close,Longlength);
shortaverage= Average(close,shortlength);
// 多方進場策略:收盤價黃金交叉均線。
if close cross above Longaverage then setposition(2);
//出場策略
COndition1 = loss_point > 26 and Close <= FilledAvgPrice - loss_point ;
COndition2 = profit_point > 62 and Close >= FilledAvgPrice + profit_point;
CONdition3 = close cross BELOW SHORTaverage;
IF COndition1 THEN BEGIN setposition(0); END
ELSE IF CONdition2 THEN BEGIN SELL(1); END
ELSE IF CONdition3 THEN BEGIN setposition(0); END;
1 評論