以下のVB.NET 2010が動作しています。しかし、TA-Libのドキュメントに記載されているデフォルト値TA_INTEGER_DEFAULTまたはTA_REAL_DEFAULTをオプションのパラメータとして使用する必要があります。私はそれをコーディングにどのように使用できますか? 現在、私は値を手動で割り当てます(値は何かを知る必要があります)。VB.NET 2010でTA_INTEGER_DEFAULTとTA_REAL_DEFAULTを使用するTA-Lib
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
この質問はdownvoteますなぜですか? – RainerJ