無法加倉,請管理員指教 [開拓者 TB]
- 咨詢內(nèi)容:
把測試代碼直接貼上來了。很簡單的,連續(xù)買兩手,過幾天全部賣掉
但是,只能看到買第一次有買入標(biāo)記,第二次買入無標(biāo)記
也就是第二次無法買入。請
//------------------------------------------------------------------------
// 簡稱: u_Test1
// 名稱: 測試
// 類別: 應(yīng)用函數(shù)
// 類型: 應(yīng)用函數(shù)
// 輸出:
//------------------------------------------------------------------------
Params
Numeric Length(20);
Numeric DevN(2);
Vars
Begin
if( BarCount-CurrentBar==6 ) {
Commentary( "buy_first" );
Buy(1,Close);
}
if( BarCount-CurrentBar==5 ) {
Commentary( "buy_second" );
Buy(1,Close);
}
if( BarCount-CurrentBar==2 ) {
Commentary( "Sell_all_2" );
Sell(1,Close);
}
End
- TB技術(shù)人員:
全局交易設(shè)置
1.png (10.05 KB, 下載次數(shù): 2) 2012-4-12 11:15:13 上傳 下載次數(shù): 2
- TB客服:
本帖最后由 gzadigo 于 2012-4-12 20:22 編輯
謝謝指教解決了!但是,新問題又來了,
圖標(biāo)中可以顯示第二次買入標(biāo)志了,但是打印出來的字符串
UT_Position = 1
并非預(yù)期的
UT_Position = 2
//------------------------------------------------------------------------
// 簡稱: u_Test1
// 名稱: 測試
// 類別: 應(yīng)用函數(shù)
// 類型: 應(yīng)用函數(shù)
// 輸出:
//------------------------------------------------------------------------
Params
Numeric Length(20);
Numeric DevN(2);
Vars
Numeric UT_Position;
Begin
if( BarCount-CurrentBar==6 ) {
Commentary( "buy_first" );
Buy(1,Close);
}
if( BarCount-CurrentBar==5 ) {
Commentary( "buy_second" );
Buy(1,Close);
}
if( BarCount-CurrentBar==3 ) {
Commentary( "Sell_all_2" );
Sell(1,Close);
}
UT_Position = MarketPosition;
Commentary( "UT_Position = " + Text(UT_Position) ); // 顯示倉位
End
- 網(wǎng)友回復(fù):
gzadigo 發(fā)表于 2012-4-12 20:08
謝謝指教解決了!但是,新問題又來了,
圖標(biāo)中可以顯示第二次買入標(biāo)志了,但是打印出來的字符串
UT_Positio ...
已經(jīng)在另外一個帖子中回復(fù)你了,請將MarketPosition替換為CurrentContracts - 網(wǎng)友回復(fù):
頂,呵呵
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價格!)
相關(guān)文章
-
指定的模型還沒有相關(guān)內(nèi)容!