OmniPilot_OnPositionClosed | Nirvana Systems Inc.

OmniPilot_OnPositionClosed

OmniPilot_OnPositionClosed

Signatures
OmniPilot.OnPositionClosed(Callback As DelegateOnPosition)

Purpose
This will establish the delegate call back for the OnPositionClosed event.  This event will fire when a current open position is closed within the currently connected broker.  The delegate will contain the SymbolObject and the PositionObject that fired the event.

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

Sub MyOnPositionClosed(ByVal oSymbol As SymbolObject, ByVal oPosition As PositionObject)
    LogAction(“Position closed on symbol ” & oSymbol.Symbol)
    LogAction(String.Format(“Exit Date: {0} Exit Price: {1} Realized P/L: {2}”, oPosition.ExitDate, oPosition.EntryPrice, oPosition.RealizedProfit))
End Sub

Also See
OnPositionClosed_Event

>