Client Terminal Events
Posted by Mohammad Rahhal, Last modified by Fouad Faraj Allah on 04 July 2019 07:16 PM

OnInit()

Description

After the client loads a script to the chart and starts the process of initialization, it will be processed by OnInit().

Syntax

Public Sub OnInit( )

DeInit( )

Description

The DeInit event is generated when the script is stopped or a new script is attached to the chart. 

Syntax

Public Sub DeInit( )

OnTick( symboolName ) 

Description

The OnTick event is generated whenever there is a new tick.

Syntax

Public Sub OnTick(symbolName)

OnCalculate( symbolName, symPeriod, OpenVal, highVal, lowVal, closeVal )

Description

This event is generated when a new candle arrives.

Syntax

Public Sub OnCalculate(symbolName, symPeriod, openVal, highVal, lowVal, closeVal)

OnTimer( )

Description

This function is called when enabling the timer using EnableTimer() and set its IntervalTimer.

Syntax

Public Sub OnTimer( )

OnOrderTrade( )

Description

This event rises after taking a new order and receiving its result from the server.

Syntax

Public Sub OnOrderTrade (actionType ,orderID , returnValue)

Parameters

Parameters Name Description
actionType The value can be one of ENUM_TRADE_ACTION_TYPE
orderID ID of order
returnValue The value can be one of ENUM_TRADE_RESULT


Return Value

Returns order lots as a double value.

OnPositionTrade( )

Description

This event rises after taking a new position and receiving its result from the server.

Syntax

Public Sub OnPositionTrade (actionType ,ticketID)

Parameters

Parameters Name Description
actionType The value can be one of ENUM_TRADE_ACTION_TYPE
TicketID Ticket ID

 

OnManageOrdersReceived()

Description

This event rises after calling RequestManageOrders() method and receiving its result from the server.

Syntax

Public Sub OnManageOrdersReceived (manageOrders)

Parameters

Parameters Name Description
manageOrders ManageOrders object

Sample

 Public Sub main()

  If AccountInfoInteger(ACCOUNT_LOGIN) Then

     If RequestManageOrders (3666) Then

    AlertMessage "The Request has been sent to the server to get all manage orders related to ticket number 3666 "

   Else

    AlertMessage  ErrorDescription(GetLastError())

   End If

  End If

 End Sub

'This event raised when calling RequestManageOrders method successfully

 Public Sub OnManageOrdersReceived(manageOrders)

    Dim i

' Receiving Manage Order related to Ticket 3666

  For i=1 To manageOrders.Count()

   AlertMessage CSTR(manageOrders.Orders(i))

  Next

 End Sub

AccountHistoryReceived()

Description

This event rises after calling GetAccountHistory() method and receiving its result from the server.

Syntax

Public Sub AccountHistoryReceived (AccountHistoryBuffer)

Parameters

Parameters Name Description
AccountHistoryBuffer Trade history collection, which contains CAccountHistory

Sample

 Public Sub main()

    GetAccountHistory "", ""

 End Sub

 

 Public sub AccountHistoryReceived (AccountHistoryBuffer)

    AlertMessage "Count” & AccountHistoryBuffer.Count

    AlertMessage "Ticket ID” & AccountHistoryBuffer.HistoryRow (1).Ticket

    AlertMessage "HisTime” & AccountHistoryBuffer.HistoryRow(1).HisTime

    AlertMessage "SymbolID” & AccountHistoryBuffer.HistoryRow (1).SymbolID

    AlertMessage "Lots” & AccountHistoryBuffer.HistoryRow (1).Lots

    AlertMessage "BuySell” & AccountHistoryBuffer.HistoryRow (1).BuySell

 End Sub


PriceLoaded()
 

Description

This event rises after request the prices or time by using HighPrices, LowPrices, ClosePricesOpenPricesand DataTimes
from the server.

Syntax

Public Sub PriceLoaded (TimeArr As Variant, OpenArr As Variant, HighArr As Variant, LowArr As Variant, closeArr As Variant)

Parameters

Parameters Name Description
TimeArr An array which contains the time values from the server.
OpenArr An array which contains the open prices values from the server.
HighArr An array which contains the high prices values from the server.
LowArr An array which contains the low prices values from the server. 
closeArr An array which contains the close prices values from the server. 

 



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