Completed
Last Updated: 17 Jul 2018 10:36 by Dimitar
ADMIN
Hristo
Created on: 09 Jul 2018 11:32
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - the MACD indicator should draw two lines, MACD - line and Signal - line
How to reproduce:
Check the attached project

Workaround:
Create a separate custom MACD indicator and add it to the chart, uncomment the commented code in the attached project

Friend Class MacdCustomIndicator
    Inherits MacdIndicator

    Private customBorderColor As Color
    Public Property BorderColor() As Color
        Get
            Return customBorderColor
        End Get
        Set(ByVal value As Color)
            customBorderColor = value
            Me.ChildIndicator.BorderColor = value
        End Set
    End Property

    Sub New()
        Dim customMacdInnerIndicator = New CustomMacdInnerIndicator(Me)
        Me.GetType().BaseType.GetField("childIndicator", BindingFlags.Instance Or BindingFlags.NonPublic).SetValue(Me, customMacdInnerIndicator)
    End Sub

End Class

Friend Class CustomMacdInnerIndicator
    Inherits MacdInnerIndicator
    Public Sub New(owner As MacdIndicator)
        MyBase.New(owner)
    End Sub

    Public Overrides Function GetProcessedValue(currentIndex As Integer) As Double

        Dim macd As Double = Me.CalculateMacdValue(currentIndex, LongPeriod, ShortPeriod)
        Me.Cache(macdValues).Add(currentIndex, macd)
        Return macd
    End Function
End Class
0 comments