Submitted the order exactly like in the sample code and API spec, however PriceType upon assignment to the Order object is getting assigned 'invalid' as the value ? Order Submission is failed with the message "Failed. Price type is required". Msg line in the below code does return "PriceType invalid" as the error message. What am I doign wrong here ?
Dim hOrder As New Order
hOrder.Side = Side
hOrder.Symbol = Symbol
hOrder.Exchange = Exchange
hOrder.PriceType = "Limit"
hOrder.TIF = "OPG"
hOrder.Account = Account
hOrder.Warning = False
hOrder.Ticket = "Bypass"
MsgBox ("PriceType " & hOrder.PriceType)
If L1Qty > 0 & Side = "Buy" & L1Select = "Yes" Then
hOrder.Price = Bid - ((L1Perc * Bid) / 100)
hOrder.Quantity = L1Qty
rtnVal1 = hOrder.Submit(errMsg)
I find that in REDI new Order population, every value populated has to be valid, and the order in which you populate/set the fields, matters.
Otherwise I have also seen this error before.
Try this order of population, please make sure every field is set with a valid value, does this help?
Dim hOrder As New Order hOrder.Side = Side hOrder.Quantity = Quantity hOrder.Symbol = Symbol hOrder.Exchange = Exchange hOrder.PriceType = PriceType hOrder.Price = Price hOrder.TIF = TIF hOrder.Account = Account hOrder.Warning = False hOrder.Ticket = "Bypass"
Unfortunately, it didn't work. I made sure valid values are passed and in the order specified as below. Still getting PriceType invalid error.
hOrder1.Side = "Buy"
hOrder1.Quantity = "10"
hOrder1.Symbol = "F"
hOrder1.Exchange = "DEMO DMA"
hOrder1.PriceType = "Limit"
hOrder1.Price = 10
hOrder1.TIF = "Day"
hOrder1.Account = "XXXXXXX"
hOrder1.Warning = False
hOrder1.Ticket = "Bypass"
MsgBox ("PriceType " & hOrder1.PriceType)
rtnVal1 = hOrder1.Submit(errMsg)
I have taken your code, as is, changing only account, replaced it in the example, and have submitted the order successfully, there is no issue with this code at this time.
Let us verify together something else. After you have made the most current changes, have you had a chance to save the VBA code and to reset the sheet by pressing the small blue square reset button?
Looks like the exchange is causing the issue. I switched the exchange to GSDE NYSE and the orders are flowing through now. However I would like to use a test exchange for further testing, is there one ? Attached are the list of exchanges in my montage screen that I see. ( screenshot below)