Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Jun 2013
    Posts
    144

    Default Please help to check open orders in client side script

    Hi Dear

    I am trying to check all open orders from client side script as follows -

    For i = 1 To OrdersTotal()

    OrderSelectByIndex(CLNG(i))

    IF OrderSymbol() = ChartSymbol(0) AND OrderGetID(CINT(i)) = 0 Then
    MsgBox OrderType()
    End IF
    Next

    This should prompt order type for each open order of current symbol having no open position i.e. pending orders.

    But it's not showing anything when I have open pending order in current pair

    Please help me to get all orders in loop by client side script.

    Thanks

  2. #2
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Post Orders Type

    Dear sir,

    if you need to know what is the type of order you have to use OrderType which is returns to you either of the following values

    (I) 1 Market Type means the order is in the chatting screen waiting the dealer approval.
    (II) 2 Limit Type means the order is pending order (Buy Limit, Sell Limit, Buy Stop, Sell Stop)
    (III) 3 SLTP Type manage order for a open position




    Code:
    For i = 1 To OrdersTotal()
    	OrderSelectByIndex(CLNG(i))
    	IF OrderSymbol() = ChartSymbol(0)  Then
    		IF OrderType = 2 Then
    			'Pending Order
    			 MsgBox OrderGetID(Clng(i))
    		End IF 
        
    	End IF
    Next

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Posts
    144

    Default

    Thanks for the help

    From OrderType property we can find pending orders
    But how can we identify whether it's a Buy Limit or Sell Limit or Buy Stop or Sell Stop?

  4. #4
    Senior Member
    Join Date
    Jun 2013
    Posts
    144

    Default

    Sorry, I am not asking to about opening new SLTP Order

    After opening a SLTP order how can we identify it's parent position. It's required to update SLTP order for Break Even, Trailing SL etc.
    In managed order there is no Open Price parameter to calculate Break Even or Update SL or TP based on market condition - This property is available in open positions
    So position's ticket number related to managed order is required to find out open price of concern managed order.
    I hope it's clear now.

  5. #5
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Default Vtl

    Dear Hasan,




    From OrderType property we can find pending orders
    But how can we identify whether it's a Buy Limit or Sell Limit or Buy Stop or Sell Stop?
    This feature is in the development cycle, it will be ready soon.

  6. #6
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Post Vtl

    Dear Hasan,


    Sorry, I am not asking to about opening new SLTP Order

    After opening a SLTP order how can we identify it's parent position. It's required to update SLTP order for Break Even, Trailing SL etc.
    In managed order there is no Open Price parameter to calculate Break Even or Update SL or TP based on market condition - This property is available in open positions
    So position's ticket number related to managed order is required to find out open price of concern managed order.
    I hope it's clear now.

    I have answered you after separating your post in a new thread.

  7. #7
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Post Vtl

    Dear Hasan,


    Now you can use OrderGetInteger to get the order type.



    Code:
    Dim TradeDescription
     Dim OrderDescription
    
     Public Sub main()
    
     Dim barNumber
     Dim result
     Dim orderId 
    
      For i= 1 to OrdersTotal
    
     result=OrderSelectByIndex(Clng(i))
    
          If Cbool(result)= TRUE Then
    
             orderId = OrderGetID(cint(i))
    
             GetOrderType result
    
             OrderGetInteger OPERATION_TYPE_ENUM,result
    
             GetTradeAction result
    
             ' The data will be Logged in this path   ...\VTL10\Log
    
            PrintData "Order Id is  : "  &  CSTR(orderId) & " ,  Operation Type is : " & CSTR(TradeDescription)
    
            OrderGetInteger ORDER_TYPE_ENUM,result
    
            GetOrderType  result
    
            ' The data will be Logged in this path   ...\VTL10\Log
    
            PrintData "Order Id is  : "  &  CSTR(orderId) & " ,  Order Type is : " & CSTR(OrderDescription)
    
          End If
    
      next
    
      End Sub
    
     Public sub GetOrderType( orderValue )
    
            If orderValue=1 then
    
                   OrderDescription="Market Order"
    
                 elseif orderValue=2 then
    
                        OrderDescription="Limit Order"
    
                 elseif actionValue=3 then
    
                        OrderDescription="SL/TP Order"
    
                 else
    
                OrderDescription="Nothing"
    
            End If
    
     End Sub
    
     Public sub GetTradeAction( actionValue )
    
            If actionValue= -2 then
    
                   TradeDescription="Sell stop"
    
                 elseif actionValue=2 then
    
                        TradeDescription="Buy stop"
    
                 elseif actionValue=-1 then
    
                        TradeDescription="Sell Limit"
    
                 elseif actionValue=1 then
    
                        TradeDescription="Buy Limit"
    
                 else
                OrderDescription="Nothing"
    
            End If
    
     End Sub

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Convert VTL from Server-side to Client-side
    By tjdm1980 in forum VertexFX API/VTL Forum
    Replies: 2
    Last Post: 01-09-2014, 09:19 AM
  2. Server side script is not running
    By nhasan in forum VertexFX API/VTL Forum
    Replies: 5
    Last Post: 10-02-2013, 01:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •