NewLimitOrder
Posted by Mohammad Rahhal, Last modified by Laith Ghawi on 04 July 2019 11:24 AM

Syntax

Public Function NewLimitOrder(vSellBuy As ENUM_TRADE_ACTION, SymbolName As String, vLots As Double, vPrice As Double, Optional vSL As Object="", Optional vTP As Object="",Optional Comment As String ="") As Boolean

Description

This function is used to make a limit order on a given trading symbol name, To get a result from the server, you have to consume OnOrderTrade event.

Parameters

Key Description 
vSellBuy Operation type, value of type ENUM_TRADE_ACTION.
SymbolName Trading Symbol name, value of type String
vLots Amount of lots, value of type Double.
vPrice Requested limit price, a value of type Double.
vSL Amount of Stop Loss, an optional value of type Object.
vTP Amount of taking Profit, an optional value of type Object.
Comment Optional value of type String used to mark the taken orders in the comment field on the trade list.

Return value

Returns true if successful, otherwise returns false. In order to get an error, call GetLastError() function.

Sample

 Public Sub main ()

  If AccountInfoInteger (ACCOUNT_LOGIN) Then
      Dim ticket
      Dim lot
      Dim Symbol
      Dim Point
      Dim piploc
      Dim Price
      Dim Ask 
      Lot = 1 
      price = 20

      Symbol = ChartSymbol (0)
      SymbolInfoDouble cstr (Symbol), SYMBOL_ASK, Ask
      SymbolInfoInteger cstr (Symbol), SYMBOL_PIP_LOCATION, piploc
      Point 10^piploc
     NewLimitOrder (TRADE_ACTION_BUY, Symbol, lot, Ask*Price*Point, "" ,"" ,”NEW Limit order by VTL”)
        If GetLastError () <> -1 then 
          AlertMessage ErrorDescription (GetLastError ())
        End If   
      End IF
  End IF

  End sub

See Also


Back to VTL Client Script Index

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions