Syntax
Public Function NewSLTPOrder(Ticket As Integer, Lots As Double, Optional SL As Variant = "", Optional TP As Variant = "", Optional TransTag As String = "") As CallingResultsEnum
Description
This function is used to create a new SL/TP order for specific position .A user account must be selected before using this method.After NewSLTPOrder method executes the NewSLTPOrderResult event fires
Parameters
Part |
Description |
Ticket |
Associated ticket number to open manage order on it ,value of type Integer. |
Lots |
Amount of lots , the value of type Double. |
SL |
Stop loss amount, the optional value of type Object. |
TP |
Take profit amount , the optional value of type Object. |
TransTag |
String value is used to mark the new SLTP order operation when the result came from the server. |
Return value
Returns value of type CallingResultsEnum , if the request sent to the server successfully it will return SuccessResult.
Sample
Public WithEvents m_oBOAPI As CVertexFXBOAPI
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As CallingResultsEnum
Dim Pos As COOpenPosition
Pos = m_oBOAPI.OpenPositionByIndex(1)
result = m_oBOAPI.NewSLTPOrder(Pos.Ticket,Pos.Lots,"",Pos.Price+2,"")
MsgBox(result)
End Sub
Private Sub m_oBOAPI_NewSLTPOrderResult(ByRef Result As VertexFXBOAPI10.NewOrderResultEnum, ByRef OrderID As Integer, ByRef ServerTime As String,TransTag as String) Handles m_oBOAPI.NewSLTPOrderResult
MsgBox(Result)
End Sub
See Also
VertexFX Backoffice API Index
|