Trendline created in EventHandler not showing up immediately

Questions about MultiCharts .NET and user contributed studies.
uprz23
Posts: 12
Joined: 27 Oct 2012
Has thanked: 2 times

Trendline created in EventHandler not showing up immediately

Postby uprz23 » 22 Oct 2022

Hi,

I'm calling DrwTrendLine.Create() in an tool bar button event handler, but the trendline is not showing up immediately. It shows up on the next bar or maybe the next tick. Is there a way to force the UI to render the trendline from the event handler immediately?

Thanks!

User avatar
Kate MultiCharts
Posts: 593
Joined: 21 Oct 2020
Has thanked: 9 times
Been thanked: 148 times

Re: Trendline created in EventHandler not showing up immediately

Postby Kate MultiCharts » 26 Oct 2022

Hi uprz23,

You can use RecalcLastBarAfter to force calculation according to the set timeout, without waiting for the next tick.

uprz23
Posts: 12
Joined: 27 Oct 2012
Has thanked: 2 times

Re: Trendline created in EventHandler not showing up immediately

Postby uprz23 » 30 Oct 2022

Thanks Kate for RecalcLastBarAfter. Is that method for the .NET version of MultiCharts? I got a compilation error when I tried to use it. "The name 'RecalcLastBarAfter' does not exist in the current context"

uprz23
Posts: 12
Joined: 27 Oct 2012
Has thanked: 2 times

Re: Trendline created in EventHandler not showing up immediately

Postby uprz23 » 30 Oct 2022

I found this that helped:

Code: Select all

// in event handler with 100 millisec delay ExecControl.RecalcLastBarAfter (new TimeSpan (0,0,0,0,100)); // add protected override void OnRecalcLastBarAfterEvent() { CalcBar(); }

From this thread viewtopic.php?t=43339

User avatar
Kate MultiCharts
Posts: 593
Joined: 21 Oct 2020
Has thanked: 9 times
Been thanked: 148 times

Re: Trendline created in EventHandler not showing up immediately

Postby Kate MultiCharts » 31 Oct 2022

Thanks Kate for RecalcLastBarAfter. Is that method for the .NET version of MultiCharts? I got a compilation error when I tried to use it. "The name 'RecalcLastBarAfter' does not exist in the current context"
Hi! It's a PowerLanguage method, sorry for misunderstanding. Glad you found the solution for your version!
Some more info that might be useful for .NET here.


Return to “MultiCharts .NET”