請教小幫手先進及版上前輩:
為何我只要在交易腳本中加入"Value1 = GetField("月營收","M");此行",回測時就會顯示"沒有任何交易資料"呢?
請問
1.該如何正確的使用"月營收"這個資料欄位?
2.該如何分辨在眾多"報價欄位(getquote)"及"資訊欄位(getfield)中,那些是可以運用在"交易腳本"中回測,而那些僅可在"選股腳本"中回測呢?
程式碼如下; 還請不吝指正,謝謝!!
Value1 = GetField("月營收","M");
condition4 = close cross Over average(close,5);
/// 進場 ///
if position=0 and condition4 then setposition(1);
/// 出場 ///
if position <> 0 and filled <> 0 then
begin
var:plratio(0);
plratio = ((close-filledAvgPrice)/filledAvgPrice)*100; //停損幅度
if plratio <= -10 then setposition(0); //-5%止損
if plratio >= 40 then setposition(0); //+40%y止盈
end;

13 評論