想在M1周期圖形求出開盤前5根Close的均價 [開拓者 TB]
- 咨詢內(nèi)容:
Params
Numeric FirstTime(9.04);
Vars
NumericSeries FirstPrice;
Begin
If(Time<FirstPrice/100)
{
FirstPrice=Close;
}
Else
{
If(Time==FirstPrice/100)
{
FirstPrice=Average(Close,BarsSinceToday+1);
}
Else
{
FirstPrice=FirstPrice[1];
}
}
Commentary("BarsSinceToday:"+Text(BarsSinceToday+1));//當(dāng)天開盤的第一根K線BarsSinceToday==0;
PlotNumeric("FirstPrice",FirstPrice);
Commentary("Time:"+Text(Time));
End
顯示FirstPrice都是等于0,是什么原因?。空埜魑桓呤帧⒗蠋熤更c。 - TB技術(shù)人員:
這樣改應(yīng)該是沒有問題的
Params
Numeric FirstTime(9.04);
Vars
NumericSeries FirstPrice;
Numeric FirstBars;
Begin
FirstBars=BarsSinceToday+1;
If(Time<FirstTime/100)
{
FirstPrice=Close;
}
Else
{
If(Time==FirstTime/100)
{
FirstPrice=Average(Close,FirstBars);//當(dāng)FirstBars是不確定的變量時,則必須使用Average;
}
Else
{
FirstPrice=FirstPrice[1];
}
}
Commentary("BarsSinceToday:"+Text(BarsSinceToday+1));//當(dāng)天開盤的第一根K線BarsSinceToday==0;
PlotNumeric("FirstPrice",FirstPrice);
End
寫代碼要細(xì)心咯,很多地方邏輯沒有錯,有筆誤也搞不出來。 - TB客服: 謝謝指點,我看了之后,想死的心都有了
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點擊查看價格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容