Updating the position of a textobject

Questions about MultiCharts .NET and user contributed studies.
AlphaCat
Posts: 69
Joined: 09 Jul 2013
Been thanked: 9 times

Updating the position of a textobject

Postby AlphaCat » 09 Feb 2015

I want to make an indicator that prints the tickvolume as a textobject next to the last bars close. My script works except for updating the y coordinate of the text-object, the x coordinate (=barnumber+2) updates as expected. It plots in the correct position for the first time, but fails to update y-coordinate on subsequent ticks.

I have set the indicator scale to "same as instrument".

Code: Select all

namespace PowerLanguage.Indicator{

[RecoverDrawings(false)]
public class TickCounter : IndicatorObject {
public TickCounter(object _ctx):base(_ctx){}

ITextObject ticks;

protected override void CalcBar(){
if(Environment.IsRealTimeCalc){
if(ticks != null){
ticks.Location = new ChartPoint(Bars.CurrentBar+2, Bars.CloseValue);
ticks.Text = " "+Bars.TicksValue.ToString()+" ";
}
else{
ticks = DrwText.Create(new ChartPoint(Bars.CurrentBar+2, Bars.CloseValue), " "+Bars.TicksValue.ToString()+" ", 1);
ticks.Color = Color.Black;
ticks.BGColor = Color.Orange;
ticks.HStyle = ETextStyleH.Right;
}
}
}
}
}
Any hints welcome, regards,
A.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Updating the position of a textobject

Postby Henry MultiСharts » 10 Feb 2015

Hello AlphaCat,

We are currently analyzing this behavior. In the meantime you can use the attached code as a workaround.
Attachments
TickCounter_wa.pln
(1.13 KiB) Downloaded 767 times

AlphaCat
Posts: 69
Joined: 09 Jul 2013
Been thanked: 9 times

Re: Updating the position of a textobject

Postby AlphaCat » 27 Feb 2015

Did your analysis yielded any results yet?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Updating the position of a textobject

Postby Henry MultiСharts » 19 Mar 2015

This issue will be resolved in MultiCharts .NET 9.1 Beta1.


Return to “MultiCharts .NET”