Trendline Indicator Slowing Down MC

Questions about MultiCharts and user contributed studies.
brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Trendline Indicator Slowing Down MC

Postby brunor » 05 Jan 2022

Adding this trendline indicator slows down MC. Any ideas on correcting this?
Appreciate any feedback.
Thank You.

Code: Select all

Input: L1(4800), StartDate(1220104), StartTime(900), EndTime(1600); Value1 = tl_new(Startdate,StartTime,L1,StartDate,EndTime,L1); tl_setstyle(Value1,1); tl_setcolor(Value1,red); Value6 = Text_New(StartDate,1600,L1,"L1"); text_setcolor(Value6,black); text_setsize(Value6,8); text_setbgcolor(Value6,white); text_setborder(Value6,True);

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Trendline Indicator Slowing Down MC

Postby TJ » 05 Jan 2022

MultiCharts is a tick driven software.
Everytime a tick comes it, the indicator will recalculate itself, and updates the variables and redraws the plots.

Trendline is different from Plots.
A new Plot will replace the old plot.

Your code as is, it draws a new line for every new tick that came in.
If you use your mouse to move the trendline, you will find another one underneath it, and so one.

To avoid this repeated drawing of trendlines,
you should put your logic within a condition.

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Trendline Indicator Slowing Down MC

Postby brunor » 06 Jan 2022

I am grateful for your reply TJ.
I'll add a condition as suggested ... now that I have a better understanding of Trendline vs. Plot.

Thank You.
Bruno


Return to “MultiCharts”