想在M1周期圖形求出開盤前5根Close的均價 [開拓者 TB]
- 咨詢內容:
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));//當天開盤的第一根K線BarsSinceToday==0;
PlotNumeric("FirstPrice",FirstPrice);
Commentary("Time:"+Text(Time));
End
顯示FirstPrice都是等于0,是什么原因啊?請各位高手、老師指點。 - TB技術人員:
這樣改應該是沒有問題的
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);//當FirstBars是不確定的變量時,則必須使用Average;
}
Else
{
FirstPrice=FirstPrice[1];
}
}
Commentary("BarsSinceToday:"+Text(BarsSinceToday+1));//當天開盤的第一根K線BarsSinceToday==0;
PlotNumeric("FirstPrice",FirstPrice);
End
寫代碼要細心咯,很多地方邏輯沒有錯,有筆誤也搞不出來。 - TB客服: 謝謝指點,我看了之后,想死的心都有了
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容