A Little Issue with Playback

Questions about MultiCharts .NET and user contributed studies.
Jobauma
Posts: 113
Joined: 16 Apr 2013
Has thanked: 25 times
Been thanked: 6 times

A Little Issue with Playback

Postby Jobauma » 02 Jun 2018

Hi.



I have found a little issue with the playback function together with an indicator I've made. There's a text object at the last bar on the chart, and the indicator creates this text object on live data ( Bars.Status != EBarState.Close ). The problem is when a bar closes, the text object disappears, which is fine, but I'll have to wait for 10 seconds before it appears again. The code is correct, but it would be nice if disappears right before open, instead of right after close. :)



Best regards,
Johannes Baumann

Jobauma
Posts: 113
Joined: 16 Apr 2013
Has thanked: 25 times
Been thanked: 6 times

Re: A Little Issue with Playback

Postby Jobauma » 03 Jun 2018

I solved it with this code:

Code: Select all

public void CreateSum( VariableSeries<ITextObject> TextObject, double Number, ETextStyleV StyleV, double Level, int Size, Color Color )
{
TextObject.Value = DrwText.Create( new ChartPoint( Bars.Time[0], Level ), Number.ToString("0.#"), true );
TextObject.Value.Size = Size;
TextObject.Value.VStyle = StyleV;
TextObject.Value.HStyle = ETextStyleH.Right;
TextObject.Value.SetFont( FontStyle.Bold, true );
TextObject.Value.Color = Color;
TextObject.Value.BGColor = m_BGColor;
TextObject.Value.FontName = "Courier New";
TextObject.Value.Locked = true;
}



protected override void CalcBar()
{
if ( Bars.Status == EBarState.Close )
{
if (Bars.LastBarOnChart)
{
if ( t_Sum[0] != 0 )
t_Sum[0].Delete();
CreateSum( t_Sum, Sum, ETextStyleV.Center, m_Average_Level, Size, m_Wave_Color )
}
}
}
Would be nice if there solution after a while though. :) Noticed that on 1M it only closes, so the text object never gets created...



Regards,
Johannes Baumann

Jobauma
Posts: 113
Joined: 16 Apr 2013
Has thanked: 25 times
Been thanked: 6 times

Re: A Little Issue with Playback

Postby Jobauma » 03 Jun 2018

Sorry!

Drop the "if ( Bars.Status == EBarState.Close )" part, and the code gets right. :)

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

Re: A Little Issue with Playback

Postby Henry MultiСharts » 07 Jun 2018

Hello Johannes,

You need to add [RecoverDrawings(False)] to your code to avoid that.

Jobauma
Posts: 113
Joined: 16 Apr 2013
Has thanked: 25 times
Been thanked: 6 times

Re: A Little Issue with Playback

Postby Jobauma » 09 Jul 2018

I couldn't make it work. I'll check it out later. :)


Return to “MultiCharts .NET”