here's a code sample to reproduce this:
Code: Select all
Imports System
Imports System.Drawing
Imports PowerLanguage
Imports PowerLanguage.Indicator
Imports PowerLanguage.Function
Imports System.Linq
Namespace PowerLanguage.Indicator
Public Class Henry_Bug_v1
Inherits IndicatorObject
Public Sub New(ByVal _ctx As Object)
MyBase.New(_ctx)
Number_Of_legs = 4
End Sub
<Input()> Public Property Number_Of_legs As Integer
Private TrendLine_Item(10) As VariableObject(Of ITrendLineObject)
Protected Overrides Sub CalcBar()
End Sub
Protected Overrides Sub Create()
For i As Integer = 0 to Number_Of_legs
Me.TrendLine_Item(i) = New VariableObject(Of ITrendLineObject)(Me)
Next i
End Sub
Protected Overrides Sub StartCalc()
For i As Integer = 0 to Number_Of_legs
Me.TrendLine_Item(i).Value = DrwTrendLine.Create(New ChartPoint(Bars.Time.Item(0), 0), New ChartPoint(Bars.Time.Item(0), 0))
Next i
End Sub
End Class
End Namespace
next, change the "Number_Of_legs" input to a higher value and get this error
The easy fix is to set the input to the max array number but its just a workaround..
Another small but annoying thing is when setting "VariableObject(Of ITrendLineObject)" as array like so:
Code: Select all
Private TrendLine_Item(10) As VariableObject(Of ITrendLineObject)
if trying to use the ".End.Price" for ex. as the auto complete suggest I get an error, if I add the ".Value" by hand then the code compiles..
Best,
R.