TF15555 v1.24 – Gestione dei segnali

Gestione dei segnali codice VBA, versione 1

Questa la maschera di gestione dei filtri

Codice VBA:

Function Segnale(prz As Double, st As Double, ma As Double, fascia As String, clusterfilter As String, mafilter As String) As String

Dim temp As String
If clusterfilter = "ON" And mafilter = "ON" Then
'buy condition with 3 filters
If prz > st And prz > ma Then
    If fascia = "LOW" Then temp = "FULL BUY"
    If fascia = "HIGH" Then temp = "TOO HIGH TO BUY"
    If fascia = "MID" Then temp = "BUY IN MID CLUSTER"
End If
If prz > st And prz < ma Then
    If fascia = "LOW" Then temp = "WAIT FOR FULL BUY"
    If fascia = "HIGH" Then temp = "TOO HIGH TO BUY"
    If fascia = "MID" Then temp = "WAIT FOR BUY IN MID CLUSTER"
End If
'sell condition with 3 filters
If prz < st And prz < ma Then
    If fascia = "HIGH" Then temp = "FULL SELL"
    If fascia = "LOW" Then temp = "TOO LOW TO SELL"
    If fascia = "MID" Then temp = "SELL IN MID CLUSTER"
End If
If prz < st And prz > ma Then
    If fascia = "HIGH" Then temp = "WAIT FOR FULL SELL"
    If fascia = "LOW" Then temp = "TOO HIGH TO BUY"
    If fascia = "MID" Then temp = "WAIT FOR BUY IN MID CLUSTER"
End If
End If
If clusterfilter = "OFF" And mafilter = "ON" Then
'buy condition with 3 filters
If prz > st And prz > ma Then
    temp = "FULL BUY"
End If
If prz > st And prz < ma Then
    temp = "WAIT FOR FULL BUY"
End If
'sell condition with 3 filters
If prz < st And prz < ma Then
    temp = "FULL SELL"
End If
If prz < st And prz > ma Then
    temp = "WAIT FOR FULL SELL"
End If
End If
If clusterfilter = "OFF" And mafilter = "OFF" Then
'buy condition with 3 filters
If prz > st Then
    temp = "FULL BUY"
End If
'sell condition with 3 filters
If prz < st Then
    temp = "FULL SELL"
End If
End If
If clusterfilter = "ON" And mafilter = "OFF" Then
'buy condition with 3 filters
If prz > st Then
    If fascia = "LOW" Then temp = "FULL BUY"
    If fascia = "HIGH" Then temp = "TOO HIGH TO BUY"
    If fascia = "MID" Then temp = "BUY IN MID CLUSTER"
End If
If prz > st Then
    If fascia = "LOW" Then temp = "WAIT FOR FULL BUY"
    If fascia = "HIGH" Then temp = "TOO HIGH TO BUY"
    If fascia = "MID" Then temp = "WAIT FOR BUY IN MID CLUSTER"
End If
End If
Segnale = temp
End Function