只開倉一次,為啥這段代碼時(shí)間到了怎么不開倉?
作者:開拓者 TB 來源:cxh99.com 發(fā)布時(shí)間:2016年05月27日
- 咨詢內(nèi)容:
- //------------------------------------------------------------------------
- // 簡稱: auto
- // 名稱: auto
- // 類別: 公式應(yīng)用
- // 類型: 用戶應(yīng)用
- //------------------------------------------------------------------------
- Vars
- StringSeries code;
- StringSeries num;
- StringSeries type;
- Numeric send_order_finished;
- Numeric order_num;
- Begin
- If(CurrentBar==0 ) {Return;}
- code = GetTBProfileString2File("D:\\TB.txt","ORDER1","Code");
- Commentary("code:"+code);
- num = GetTBProfileString2File("D:\\TB.txt","ORDER1","Num");
- Commentary("num:"+num);
- type = GetTBProfileString2File("D:\\TB.txt","ORDER1","Type");
- Commentary("type:"+type);
- send_order_finished = GetGlobalVar(0);
- Commentary("send_order_finished:"+Text(send_order_finished));
- order_num=Value(num);
- If (CurrentTime>0.114000 && send_order_finished==InvalidNumeric)
- {
- If (Type=="Buy")
- {
- Data0.A_SendOrder(Enum_Buy,Enum_Entry,order_num,Close);
- }
- If (Type=="Sell")
- {
- Data0.A_SendOrder(Enum_Sell,Enum_Entry,order_num,Close);
- }
- send_order_finished=1;
- SetGlobalVar(0,send_order_finished);
- }
-
- //SetTBProfileString2File("D:\\TB.txt","ORDER1","Code","IF1603");
- //SetTBProfileString2File("D:\\TB.txt","ORDER2","Code","IF1604");
- //SetTBProfileString2File("D:\\TB.txt","ORDER3","Code","IF1605");
- //SetTBProfileString2File("D:\\TB.txt","ORDER1","Num","100");
- //SetTBProfileString2File("D:\\TB.txt","ORDER2","Num","200");
- //SetTBProfileString2File("D:\\TB.txt","ORDER3","Num","300");
- //SetTBProfileString2File("D:\\TB.txt","ORDER1","Type","Sell");
- //SetTBProfileString2File("D:\\TB.txt","ORDER2","Type","Buy");
- //SetTBProfileString2File("D:\\TB.txt","ORDER3","Type","Sell");
- End
-
- //------------------------------------------------------------------------
- // 編譯版本 GS2015.12.25
- // 用戶版本 2016/03/10 10:37:39
- // 版權(quán)所有 akward
- // 更改聲明 TradeBlazer Software保留對TradeBlazer平臺
- // 每一版本的TradeBlazer公式修改和重寫的權(quán)利
- //------------------------------------------------------------------------
- TB技術(shù)人員:
- TB客服:
使用a_xxxx的發(fā)單 沒有限制在最后K線上這一條件嗎??
這樣是可能導(dǎo)致在歷史K線上就滿足其它條件,導(dǎo)致條件內(nèi)的數(shù)據(jù)被修改,而事實(shí)上因?yàn)椴辉谧詈驥線所以委托單還沒有發(fā)出去呀。。
建議上層條件加上 if(barstatus==2)的限制。
其次,公式里需要加上調(diào)試語句,例如fileappend等來記錄各條件的狀態(tài)值這樣才好定位問題,并進(jìn)行修正。
- 網(wǎng)友回復(fù):
great!
搞定,多謝小米!