Author |
Topic: Excel DOM example not working (2 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
ASykes4318 Posts: 18 Joined: |
The following statement is giving us the following error from the excel DOM Code:
• Object doesn't support this property or method Is there an update code procedure that works with the new GF API?? We would like to also send maindraft and draftTP only also is this possible?? orders.SendLinkedOrders mainDraft, OSOGroupingMethod_ByPrice, linked Sub SendOrder(side As OrderSide, row As Integer, qty As Integer) On Error GoTo Err 'Stop Dim account As account Set account = CurrentAccount If account Is Nothing Then MsgBox "Invalid account" Else Dim Price As Double Price = CurrentTop - (row - TopRow) * CurrentContract.tickSize If qty < 0 Then DecreaseQty side, Price, -qty, account Else Dim Builder As OrderDraftBuilder Set Builder = New OrderDraftBuilder Builder.WithSide side Builder.WithPrice Price Builder.WithQuantity qty Builder.WithContractID CurrentContract.ID Builder.WithComments "DOM" Builder.WithAccountID account.ID If (side = OrderSide_Buy) And (Price CurrentContract.CurrentPrice.LastPrice) Then Builder.WithOrderType (OrderType_Limit) Else Builder.WithOrderType (OrderType_Stop) End If Dim sl As Integer, tp As Integer sl = Range("K6") tp = Range("K7") Dim mainDraft As OrderDraft Dim draftSL As OrderDraft Dim draftTP As OrderDraft Set mainDraft = Builder.Build If (sl = 0) And (tp = 0) Then Stop orders.SendOrder mainDraft Else If sl 0 Then If mainDraft.side = OrderSide_Buy Then Builder.WithSide OrderSide_Sell Builder.WithPrice mainDraft.Price - sl * CurrentContract.tickSize Else Builder.WithSide OrderSide_Buy Builder.WithPrice mainDraft.Price + sl * CurrentContract.tickSize End If Builder.WithOrderType OrderType_Stop Set draftSL = Builder.Build End If If tp 0 Then If mainDraft.side = OrderSide_Buy Then Builder.WithSide OrderSide_Sell Builder.WithPrice mainDraft.Price + tp * CurrentContract.tickSize Else Builder.WithSide OrderSide_Buy Builder.WithPrice mainDraft.Price - tp * CurrentContract.tickSize End If Builder.WithOrderType OrderType_Limit Set draftTP = Builder.Build End If Dim linked As OrderDraftList Set linked = New OrderDraftList If (tp 0) Then linked.Add draftTP End If If sl 0 Then linked.Add draftSL End If orders.SendLinkedOrders mainDraft, OSOGroupingMethod_ByPrice, linked End If End If End If Exit Sub Err: MsgBox Err.Description End Sub Anthony Sykes
|
||||
SRuscak Posts: 50 Joined: Aug 24, 2017 |
Hello,
Yes, this code is pretty old. I improved the area around this function and it will be released in the next COM package. SendLinkedOrders is no longer valid. You are looking for SendOSOOrders, and can see this in the C# documentation. https://gainfutures.com/GFAPI/html/T_GF_Api_Orders_IOrdersApi.htm Here is an improved VBA subroutine:
|
||||