Events_OnPositionClosed | Nirvana Systems Inc.

Events_OnPositionClosed

Events_OnPositionClosed

This will insert the correct method signature needed to hook or trap the OnPositionClosed event fired from OmniTrader.  This event fires anytime an open position is closed at the currently selected broker.  Double clicking this item will insert the following code.

Sub MyOnPositionClosed(ByVal oSymbol As SymbolObject, ByVal oPosition As PositionObject)
    ‘ statements
End Sub

You can change the method name (MyOnPositionClosed) to anything you like however the signature must remain unchanged in order to establish the hook. To actually establish the hook you need to call OmniPilot.OnPositionClosed(AddressOf )

Example
Sub OnStartup
    OmniPilot.OnPositionClosed(AddressOf MyOnPositionClosed)
End Sub

Sub MyOnPositionClosed(ByVal oSymbol As SymbolObject, ByVal oPosition As PositionObject)
    LogAction(oSymbol.Symbol & ” has been close with a P/L=” & oPosition.RealizedProfit)
End Sub

Also See
OmniPilot.OnPositionClosed

>