無法實現(xiàn)數(shù)值型序列數(shù)據(jù)傳遞?
作者:開拓者 TB 來源:cxh99.com 發(fā)布時間:2014年12月04日
- 咨詢內(nèi)容:
你好,我想實現(xiàn)的原理是:昨天收盤價和30天前收盤價的差值InterPrice,最新InterPrice 的低于60天最低值時開多倉。我的寫法有什么地方不對,實現(xiàn)不了,謝謝
Params
Numeric Lots(1);
Numeric DLength(31); //取值時間間隔
Numeric LLength(60); //新低比較間隔
Numeric X(10); //持倉時間
Vars
NumericSeries InterPrice;
NumericSeries Lprice;
Numeric i;
Numeric LowPrice;
Begin
InterPrice = Close - Close[DLength]; //當日收盤時隔DayLength的差值
LowPrice=InterPrice;
For i=1 To LLength
{
if (InterPrice[i] < LowPrice)
{
LowPrice = InterPrice[i];
}
}
Lprice = LowPrice;
If(MarketPosition<>1 && InterPrice == Lprice);
{
Buy(Lots,Close);
}
if(MarketPosition==1 && BarsSinceEntry==x)
{
Sell(Lots,Close);
}
Commentary(Text(InterPrice));
Commentary(Text(Lprice));
End
- TB技術人員:
60天最低值不直接調(diào)用函數(shù)Lowest(InterPrice,60)就行了