Events_OnSignal | Nirvana Systems Inc.

Events_OnSignal

Events_OnSignal

This will insert the correct method signature needed to hook or trap the OnSignal event from OmniTrader.

This event fires when OT runs analysis on an individual symbol and is used to determin the current voting of that symbol.  This should only be used for Real Time signals, not End of Day signals.  Double clicking this item will insert the following code.

Sub MyOnSignal(ByVal oSymbol As SymbolObject, ByVal oSignal As SignalObject)
    ‘ statements
End Sub

You can change the method name (MyOnSignal) to anything you like however the signature must remain unchanged in order to establish the hook. To actually establish the hook so that this method is executed when the OnSignal event fires you need to call OmniPilot.OnSignal(AddressOf ).

Example
Sub OnStartup
    StartOT
    OmniPilot.OnSignal(AddressOf MyOnSignal)
End Sub

Sub MyOnSignal(ByVal oSymbol As SymbolObject, ByVal oSignal As SignalObject)
    LogAction(“Voting symbol ” & oSymbol.Symbol & ” on the ” & oSignal.TimeFrame & ” timeframe”)
    LogAction(“Current Signal = ” & GetSignalName(oSignal.CurrentSignal) & ” – Previous Signal = ” & GetSignalName(oSignal.PreviousSignal))
End Sub

Private Function GetSignalName(ByVal nSignal As Integer) As String
    Dim sSignal As String = Nothing

    If IsDelayedLongSignal(nSignal) Then sSignal &= “Delayed Long”

    If IsDelayedShortSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”    ‘ If we already have one signal type add seperator
        sSignal &= “Delayed Short”
    End If

    If IsNewLongSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “New Long”
    End If

    If IsNewShortSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “New Short”
    End If

    If IsInLongTradeSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “In Long”
    End If

    If IsInShortTradeSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “In Short”
    End If

    If IsReinforcedLongSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “Reinforced Long”
    End If

    If IsReinforcedShortSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “Reinforced Short”
    End If

    If IsExitSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal &= “Exit”
    End If

    If IsNoSignal(nSignal) Then
        If Not (sSignal Is Nothing) Then sSignal &= “\”
        sSignal = “No Signal”
    End If

    If sSignal Is Nothing Then Return “*Unknown*”                                ‘ Signal type is unknown

    Return sSignal
End Function

Also See
OmniPilot.OnSignal

>