I'm using trade lines to draw lines in the future (in this case 26 bars ahead of last bar):
When in Playback mode, once I get to end of session the drawing skips few bars:
If I recalculate the indicator at the above step:
Then it redraw it as it should have:
This is the code I've used for this example on a 1 minute chart:
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_Trendline_EndOfDay
Inherits IndicatorObject
Public Sub New(ByVal _ctx As Object)
MyBase.New(_ctx)
End Sub
Private TrendLine As VariableObject(Of ITrendLineObject)
Protected Overrides Sub CalcBar()
Dim MyBar As Integer = Bars.CurrentBarAbsolute + 26
TrendLine.Value = DrwTrendLine.Create(New ChartPoint(Bars.Time.Item(0), 0), New ChartPoint(Bars.Time.Item(0), 0))
TrendLine.Value.End = New ChartPoint(MyBar, Bars.Close(0)+10)
TrendLine.Value.Begin = New ChartPoint(MyBar, Bars.Close(0))
TrendLine.Value.Size = 1
TrendLine.Value.Style = 2
End Sub
Protected Overrides Sub Create()
TrendLine = New VariableObject(Of ITrendLineObject)(Me)
End Sub
Protected Overrides Sub StartCalc()
End Sub
End Class
End Namespace
Best,
R.