幫忙看下這有一段撤單指令的編寫問題 [開拓者 TB]
- 咨詢內容:
本帖最后由 fushengchenken 于 2016-1-29 16:02 編輯
這段程序代碼是在1分鐘的K線上運行的平倉指令,請幫我看下這段撤單和從新平倉的指令的問題
If(A_TotalPosition>0 And A_GetOpenOrderCount!=0)
{
A_DeleteOrder();
MyExitDelete=MyExitDelete+1;
SetGlobalVar(14,MyExitDelete);
If(MyExitDelete>0)
{
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition(),Close-ExitSlippage*MinMove*PriceScale);
MyBuyExit=MyBuyExit+1;
SetGlobalVar(8,MyBuyExit);
MyExitTime=Time;
SetGlobalVar(11,MyExitTime);
}
If(A_GetLastOpenOrderIndex(Enum_Sell,Enum_Exit)==InvalidInteger)
{
MyEntryTime=0;
SetGlobalVar(10,MyEntryTime);
}
}
我想實現的目標是:
1.一但有多單持倉并且有未成交的多單就立刻撤單,并將 MyExitDelete+1做為全局變量做一個記錄。
2.如果一但有過一次撤單以后立刻再次平倉多單,并且用A_GetLastOpenOrderIndex(Enum_Buy,Enum_Exit)==InvalidInteger指令來判斷平倉指令是否成功。一旦確認平倉成功了,再將MyEntryTime清0.
3.我要讓這個指令重復運行,以達到不斷的平倉撤單,再平倉再撤單直到平倉成功,這樣一個效果。
目前遇到一些始終解決不掉,又找不到問題的原因的地方,希望TB的技術人員幫忙看看:
問題1:我咨詢過你們TB的服務人員,他們告訴我TB的運行機制是會在一分鐘的K線的最后一個TICK合并下一個1分鐘的K線合并計算?我不知道這個敘述清楚沒有。這里面有個問題我下面截取一張圖表來咨詢。遇到的問題是為什么在賬戶都完全沒有持倉的情況下,程序總會在每個1分鐘的最后一個TICK上面撤單一次?(見下圖1紅色加粗數據)
問題2:
QQ截圖20160129143856.png (6.58 KB, 下載次數: 0) 2016-1-29 14:38:41 上傳 - TB技術人員:
圖1見紅色加粗部分
Time=0.1124 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1124 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1124 MyTimeSecondValue=0 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1124 MyExitDelete=1 Date=2016-01-29
- TB客服:
圖1見紅色加粗部分
Time=0.1125 MyTimeSecondValue=57 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1125 MyTimeSecondValue=57 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1125 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1125 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1125 MyTimeSecondValue=59 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1125 MyTimeSecondValue=59 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1125 MyExitDelete=1 Date=2016-01-29 - 網友回復:
圖1見紅色加粗部分
Time=0.1126 MyTimeSecondValue=53 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1126 MyTimeSecondValue=54 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1126 MyTimeSecondValue=55 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1126 MyTimeSecondValue=56 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1126 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1126 MyTimeSecondValue=59 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1126 MyExitDelete=1 Date=2016-01-29 - 網友回復:
本帖最后由 fushengchenken 于 2016-2-1 11:05 編輯
圖2見紅色加粗部分
Time=0.1333 MyTimeSecondValue=31 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=31 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=31 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=32 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=32 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=33 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=33 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=34 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=35 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=35 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=36 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=36 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=37 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1333 MyExitDelete=0 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=38 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=39 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=39 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=40 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=41 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=41 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=44 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=46 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=46 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=47 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=48 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
Time=0.1333 MyTimeSecondValue=49 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容