'摘录的部分下止损单代码
Sub PleaceStopOrder(Grid,Stp,Vol)
dim MinTick
dim Multipliter
dim ShortPercent
dim LongPercent
call order.Contract(Grid.Stocklabel, GRid.Market, Multipliter, Mintick, ShortPercent, LongPercent)
dim BuyHoding
dim BuyTodayHoding
dim SellHoding
dim SellTodayHoding
dim BuyCost
dim SellCost
dim PNL
dim Usemargin
'取指定持仓品种信息
Result = Order.HoldingInfoByCode2(Grid.Stocklabel, GRid.Market,BuyHoding,buycost,BuyTodayHoding,SellHoding,sellcost,SellTodayHoding,pnl,usemargin)
If Result <> 1 Then
Exit Sub
End If
Set ReportData = Grid.GetReportData
if buytodayhoding > 0 then
if Vol = 0 then
Vol = BuyTodayHoding
end if
Price = BuyCost - Stp*MinTick
call Order.Sell(2,Vol,Price,0,Grid.Stocklabel, GRid.Market,"",0)
Technic.ShowKeyFairy=0
ElseIf SellTodayHoding > 0 then
if Vol = 0 then
Vol = SellTodayHoding
end if
Price =SellCost + Stp*MinTick
call Order.SellShort(2,Vol,Price,0,Grid.Stocklabel, GRid.Market,"",0)
Technic.ShowKeyFairy=0
end if
end sub