怎樣用VBS實現指定賬戶權益低于90萬時強行平倉? [金字塔]
- 咨詢內容:
如題
- 金字塔客服:
樓主可以打開幫助參考下VBA中的Order對象
另外軟件內下單設置——止盈止損中中也是可以設置的
- 用戶回復:
- 網友回復:
使用VBA編寫的代碼量較大,在此無法給你編寫完整的,給出你一個實現的想法思路
1、你應該了解金字塔VBA的定時器功能,定期1秒檢測帳戶的動態權益,有關定時器的部分論壇已經很多討論了,你可以自行搜索一下
2、這里給你摘抄部分的判斷動態權益全部強平的部分代碼
IsAlarm = 0'是否已經有過預警動作
dynamicpower= order.Account2(6,account)'得到賬戶動態權益
cash= order.Account2(3,account)'得到賬戶里的現金余額'//////////////////////////////////////////////////////////////////////////////////////////達到全平警戒線 強平資金:103,5000 當前權益只有103.5W的時候強平當前所有持倉
if dynamicpower<Forced_liquidation_capital and Count1 + Count2 > 0 then
application.PlaySoundFile "OrderNotify.wav"
IsAlarm = 1
Forced=1
if count1 > 0 Or Count2 > 0 then
application.MsgOut "強平"&Account&"賬戶所有持倉"
application.MsgOut "動態權益: "&dynamicpower
application.MsgOut "強平資金: "&Forced_liquidation_capital
Document.DebugFile "C:\OrderLog.txt","執行了強平:"&Account&"賬戶所有持倉", 1
End if
'//////////////////////////////////////////////////////////////////////////////////////////全平操作
dim BuyHoding
dim BuyCost
dim BuyTodayHoding
dim SellHoding
dim SellCost
dim SellTodayHoding
dim PNL
dim UseMargin
dim Code
dim Market
for i=0 to count1 - 1
Result = Order.HoldingInfo2(i,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin ,Code,Market)
If Result <> 1 Then
exit sub
End If
set Report1 = marketdata.GetReportData(Code,Market)
'application.MsgOut Report1.NewPriceif BuyHoding<>0 then
call order.Sell(1,BuyHoding,Report1.NewPrice,0,Code,Market,account,0)
application.MsgOut "品種:"&Code & " 平多:"&BuyHoding &" 賬戶:"&account
end if
if SellHoding<>0 then
call order.Sellshort(1,SellHoding,Report1.NewPrice,0,Code,Market,account,0)
application.MsgOut "品種:"&Code & " 平空:"&SellHoding&" 賬戶:"&account
end if
next
for i=0 to count2 - 1Result = Order.HoldingInfo(i, BuyHoding, BuyCost, BuyTodayHoding, SellHoding, SellCost, PNL, Code, Market)
If Result <> 1 Then
exit sub
End If
set Report1 = marketdata.GetReportData(Code,Market)
'application.MsgOut Report1.NewPriceif BuyHoding>0 then
call order.Sell(1,BuyHoding,Report1.NewPrice,0,Code,Market,account,0)
application.MsgOut "品種:"&Code & " 平多:"&BuyHoding &" 賬戶:"&account
end if
if BuyHoding<0 then
call order.Sellshort(1,BuyHoding,Report1.NewPrice,0,Code,Market,account,0)
application.MsgOut "品種:"&Code & " 平空:"&abs(BuyHoding) &" 賬戶:"&accountend if
next
end if
如果以上指標公式不適用于您常用的行情軟件
或者您想改編成選股公式,以便快速選出某種形態個股的話,
- 上一篇:_declspec(dllexport) int WINAPI MYMAVA…
- 下一篇:沒有了!
相關文章
-
沒有相關內容