程序主要功能是监控账户资金,当资金低于aa会做出提醒,然后资金低于aa1依然会做出提醒,并且会执行一个强制平掉所以仓位的动作,
另外在有隔夜单的情况下,(我们把15点13分后未平仓的单子归属于隔夜单),可用资金必须大于aa2,否则抢平,直到可用金大于aa2,
我用的是金字塔最高版本金钻版所以不受版本要求限制,请各位版主们帮忙写下
你不是版主吗?你就是高人啊。。。帮帮忙吧
问题正在处理,需要时间可能会稍久一些
因为你这里没有下单语句 所以隔夜单必须要用事件捕捉。
其余代码如下,写出了大致思路,仅供参考,需要微调 有问题可以继续咨询
dim aa
aa=99999
dim aa1
aa1=50000
dim aa2
aa1=25000
sub application_vbastart()
call marketdata.regreportnotify("if12","zj")
end sub
'public filltime
sub marketdata_reportnotify(reportdata)
dim i
dim BuyHold
dim BuyCost
dim SellHold
dim SellCost
dim CurCode
dim CurMarket
a1=order.Account(3)
call application.msgout(a1)
if a1<aa then
call application.msgout("可用资金小于了aa")
end if
if a1<aa1 then
call application.msgout("可用资金小于了aa1")
HoldingCount=Order.Holding2("88")
If HoldingCount>0 then
For i=0 to HoldingCount-1
Call Order.HoldingInfo2(i,BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin,Code,Market,sAccount)
CurCode=Code
CurMarket=Market
BuyHold=BuyHolding
SellHold=SellHolding
if BuyHold>0 then
call order.Sell(1,BuyHold,0,CurCode,CurMarket,"88",0)
end if
if SellHold>0 then
call order.Sell(1,BuyHold,0,CurCode,CurMarket,"88",0)
end if
NEXT
end if
end if
end sub
在未来我可能会有两个三个甚至更多个的账户需要进行这样的风控的时候,我应该怎么样去进行修整