Script
‘‘‘########################################################
‘‘‘####Script Name: MarketOrder if Bid ####
‘‘‘####Script Description: This Server Script will take an order based on Symbol’s Bid####
‘‘‘####Author: Yousef Najjar ####
‘‘‘####Website: http://www.hybridsolutions.com ####
‘‘‘####Date: 22 / March / 2012 ####
‘‘‘#######################################################
Sample
Dim _symbolInfo as VTLGeneral.CSymbol=ClientCode.GetSymbolByName("GOLD")Dim _NewOrderRecieved as NewOrderInfoDim _lots as double = 1Public Sub main()Dim balance, FltPL, credite, equity, marginReq, marginLevel, EFFmargine As DoubleDim result as VTLGeneral.CallingResultsEnumresult=ClientCode.AccountSummaries(balance, FltPL, credite, equity, marginReq, marginLevel, EFFmargine ) gui.msgdialog (balance)if balance < 100 Thengui.msgdialog ("Unable to perform operation due to low balance")Else'If result=1 Then'GUI.MsgDialog("balance : " & balance.Tostring & " , FltPL : " & FltPL.Tostring & " , credite : " & credite.Tostring & " , equity : " & equity.Tostring & " , marginReq : " & marginReq.Tostring & " , marginLevel : " & marginLevel.Tostring & " , EFFmargine" & EFFmargine.Tostring)ClientCode.NewMarketOrder(1,_symbolInfo.ID,_lots)GUI.MsgDialog("New Market Order has been done") End ifEnd SubPublic Sub OnCloseOrderResultRecieved(ByRef Result As VTLServerApplication.NewOrderResultEnum, ByRef AtPrice As Double, ByRef PosOrOrder As Short, ByRef OrderId As Integer, ByRef BuySell As VTLServerApplication.OperationTypeEnum, ByRef Lots As Double, ByRef Symbol As VTLServerApplication.CSymbol, ByRef ServerTime As String, ByRef OpenTicket As Integer)GUI.MsgDialog("order has been closed ")End SubPublic Sub OnNewOrderResultRecieved(ByRef Result As VTLServerApplication.NewOrderResultEnum, ByRef AtPrice As Double, ByRef PosOrOrder As Short, ByRef OrderId As Integer, ByRef BuySell As VTLServerApplication.OperationTypeEnum, ByRef Lots As Double, ByRef Symbol As VTLServerApplication.CSymbol, ByRef ServerTime As String)_NewOrderRecieved= New NewOrderInfo_NewOrderRecieved.Result=Result_NewOrderRecieved.AtPrice=AtPrice_NewOrderRecieved.PosOrOrder =PosOrOrder _NewOrderRecieved.OrderId =OrderId_NewOrderRecieved.BuySell =BuySell_NewOrderRecieved.Lots=Lots_NewOrderRecieved.Symbol =Symbol _NewOrderRecieved.ServerTime =ServerTimeEnd SubPublic Class NewOrderInfoPrivate _Result As VTLServerApplication.NewOrderResultEnumPrivate _AtPrice As DoublePrivate _PosOrOrder As ShortPrivate _OrderId As IntegerPrivate _BuySell As VTLServerApplication.OperationTypeEnumPrivate _Lots As DoublePrivate _Symbol As VTLServerApplication.CSymbolPrivate _ServerTime As StringPublic Property Result() As VTLServerApplication.NewOrderResultEnumGetReturn _ResultEnd GetSet(ByVal value As VTLServerApplication.NewOrderResultEnum)_Result = valueEnd SetEnd PropertyPublic Property AtPrice() As DoubleGetReturn _AtPriceEnd GetSet(ByVal value As Double)_AtPrice = valueEnd SetEnd PropertyPublic Property PosOrOrder() As ShortGetReturn _PosOrOrderEnd GetSet(ByVal value As Short)_PosOrOrder = valueEnd SetEnd PropertyPublic Property OrderId() As IntegerGetReturn _OrderIdEnd GetSet(ByVal value As Integer)_OrderId = valueEnd SetEnd PropertyPublic Property BuySell() As VTLServerApplication.OperationTypeEnumGetReturn _BuySellEnd GetSet(ByVal value As VTLServerApplication.OperationTypeEnum)_BuySell = valueEnd SetEnd PropertyPublic Property Lots() As DoubleGetReturn _LotsEnd GetSet(ByVal value As Double)_Lots = valueEnd SetEnd PropertyPublic Property Symbol() As VTLServerApplication.CSymbolGetReturn _SymbolEnd GetSet(ByVal value As VTLServerApplication.CSymbol)_Symbol = valueEnd SetEnd PropertyPublic Property ServerTime() As StringGetReturn _ServerTimeEnd GetSet(ByVal value As String)_ServerTime = valueEnd SetEnd PropertyEnd Class
See Also