無法加倉,請管理員指教 [開拓者 TB]
- 咨詢內容:
把測試代碼直接貼上來了。很簡單的,連續買兩手,過幾天全部賣掉
但是,只能看到買第一次有買入標記,第二次買入無標記
也就是第二次無法買入。請
//------------------------------------------------------------------------
// 簡稱: u_Test1
// 名稱: 測試
// 類別: 應用函數
// 類型: 應用函數
// 輸出:
//------------------------------------------------------------------------
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技術人員:
全局交易設置
1.png (10.05 KB, 下載次數: 2) 2012-4-12 11:15:13 上傳 下載次數: 2
- TB客服:
本帖最后由 gzadigo 于 2012-4-12 20:22 編輯
謝謝指教解決了!但是,新問題又來了,
圖標中可以顯示第二次買入標志了,但是打印出來的字符串
UT_Position = 1
并非預期的
UT_Position = 2
//------------------------------------------------------------------------
// 簡稱: u_Test1
// 名稱: 測試
// 類別: 應用函數
// 類型: 應用函數
// 輸出:
//------------------------------------------------------------------------
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
- 網友回復:
gzadigo 發表于 2012-4-12 20:08
謝謝指教解決了!但是,新問題又來了,
圖標中可以顯示第二次買入標志了,但是打印出來的字符串
UT_Positio ...
已經在另外一個帖子中回復你了,請將MarketPosition替換為CurrentContracts - 網友回復:
頂,呵呵
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 262069696 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
指定的模型還沒有相關內容!