TA-Lib 在 VB.NET 2010 中使用 TA_INTEGER_DEFAULT 和 TA_REAL_DEFAULT

TA-Lib using TA_INTEGER_DEFAULT and TA_REAL_DEFAULT in VB.NET 2010

VB.NET 以下 2010 正在运行。但我需要使用 TA-Lib 文档中所述的默认值:TA_INTEGER_DEFAULT 或 TA_REAL_DEFAULT 作为可选参数。我如何在编码中使用它? 目前我手动分配值(需要知道值是什么)。

Public Sub CalcMACD()
        ' CALCULATE allocationSize
        Dim lookback As Integer = TicTacTec.TA.Library.Core.MacdLookback(optInFastPeriod, optInSlowPeriod, optInSignalPeriod)
        Dim temp As Integer = Math.Max(lookback, startIdx)
        If (temp > endIdx) Then
            allocationSize = 0                    ' No output
        Else
            allocationSize = endIdx - temp + 1
        End If

        optInFastPeriod = 12                                 ' Set optional values <==== HOW TO USE TA_INTEGER_DEFAULT
        optInSlowPeriod = 26                                 ' Set optional values <==== HOW TO USE TA_INTEGER_DEFAULT
        optInSignalPeriod = 9                                ' Set optional values <==== HOW TO USE TA_INTEGER_DEFAULT

        Dim outMACD As Double()                                                       ' Declare output variable type
        ReDim outMACD(allocationSize)
        Dim outMACDSignal As Double()                                                 ' Declare output variable type
        ReDim outMACDSignal(allocationSize)
        Dim outMACDHist As Double()                                                   ' Declare output variable type
        ReDim outMACDHist(allocationSize)

        ' the calculation
        Dim res As TicTacTec.TA.Library.Core.RetCode = TicTacTec.TA.Library.Core.Macd(startIdx, endIdx, openPrice, optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outBegIdx, outNBElement, outMACD, outMACDSignal, outMACDHist)


        ' Add result column to Datagridview
        ' #1 add column to Datagridview1
        DataGridView1.ColumnCount = DataGridView1.ColumnCount + 3
        Dim columnID As Integer = DataGridView1.ColumnCount - 3
        ' #2 define column header
        DataGridView1.Columns(columnID).HeaderText = "MACD"
        DataGridView1.Columns(columnID + 1).HeaderText = "MACD Signal"
        DataGridView1.Columns(columnID + 2).HeaderText = "MACD Histogram"
        '#3 insert values to column
        For i As Integer = startIdx To endIdx
            DataGridView1(columnID, i).Value = outMACD(i)
            DataGridView1(columnID + 1, i).Value = outMACDSignal(i)
            DataGridView1(columnID + 2, i).Value = outMACDHist(i)
        Next
End Sub
Public Sub CalcMACD(Optional ByVal optInFastPeriod As Integer = TA_INTEGER_DEFAULT, Optional ByVal optInSlowPeriod As Integer = TA_INTEGER_DEFAULT, Optional ByVal optInSignalPeriod As Integer = TA_INTEGER_DEFAULT)

    ' CALCULATE allocationSize
    Dim allocationSize As Integer = 0
    Dim lookback As Integer = TicTacTec.TA.Library.Core.MacdLookback(optInFastPeriod, optInSlowPeriod, optInSignalPeriod)

    Dim temp As Integer = Math.Max(lookback, startIdx)
    If (temp < endIdx) Then
        allocationSize = endIdx - temp + 1
    End If

    ' Declare output variables
    Dim outMACD(allocationSize) As Double
    Dim outMACDSignal(allocationSize) As Double                                              
    Dim outMACDHist(allocationSize) As Double

    ' the calculation
    Dim res As TicTacTec.TA.Library.Core.RetCode = TicTacTec.TA.Library.Core.Macd(startIdx, endIdx, openPrice, optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outBegIdx, outNBElement, outMACD, outMACDSignal, outMACDHist)

    ' Add result column to Datagridview
    ' #1 add column to Datagridview1
    DataGridView1.ColumnCount = DataGridView1.ColumnCount + 3
    Dim columnID As Integer = DataGridView1.ColumnCount - 3
    ' #2 define column header
    DataGridView1.Columns(columnID).HeaderText = "MACD"
    DataGridView1.Columns(columnID + 1).HeaderText = "MACD Signal"
    DataGridView1.Columns(columnID + 2).HeaderText = "MACD Histogram"
    '#3 insert values to column
    For i As Integer = startIdx To endIdx
        DataGridView1(columnID, i).Value = outMACD(i)
        DataGridView1(columnID + 1, i).Value = outMACDSignal(i)
        DataGridView1(columnID + 2, i).Value = outMACDHist(i)
    Next
End Sub