Programmatically extending lines without specifying price

Questions about MultiCharts and user contributed studies.
janus
Posts: 838
Joined: 25 May 2009
Has thanked: 64 times
Been thanked: 105 times

Programmatically extending lines without specifying price

Postby janus » 24 Apr 2022

I often need to extend a line in EL by using the tl_setend_bn function keeping the slope the same. To do so I need to compute the projected price by first computing the slope and applying the linear equation to compute the end price at the requisite bar number. I've written my own function to do all that. Is there a built-in function that allows me just to specify the new end bar number and EL does the rest, keeping the slope of the line constant?

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Programmatically extending lines without specifying price

Postby ABC » 25 Apr 2022

janus,

TL_GetValue_BN might do what you have in mind.
Returns a price value, at the specified bar number, of a trendline with the specified ID number; returns a value of -2 if the specified trendline ID number is invalid.

If the trendline does not extend to the specified bar, a price value along the same slope as the trendline will be returned.
You would still have to update the line end point, though. As far as I am aware, there is no reserved word for updating trendlines that would allow specifying just the bar number.

Regards,

ABC
I often need to extend a line in EL by using the tl_setend_bn function keeping the slope the same. To do so I need to compute the projected price by first computing the slope and applying the linear equation to compute the end price at the requisite bar number. I've written my own function to do all that. Is there a built-in function that allows me just to specify the new end bar number and EL does the rest, keeping the slope of the line constant?

janus
Posts: 838
Joined: 25 May 2009
Has thanked: 64 times
Been thanked: 105 times

Re: Programmatically extending lines without specifying price

Postby janus » 25 Apr 2022

TL_GetValue_BN might do what you have in mind.
Tried that. Returns 0 when the bar number is outside the range of the line. Not to worry. I'll keep using my function that computes the extended price given details of the line.

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Programmatically extending lines without specifying price

Postby ABC » 25 Apr 2022

I must admit I have not tried it, but it sounds like this could be a bug. At least it goes against the description from the help file (the bold part in my first reply).

Can someone from Multicharts please comment if this is bug or intended behavior?

Regards,

ABC
TL_GetValue_BN might do what you have in mind.
Tried that. Returns 0 when the bar number is outside the range of the line. Not to worry. I'll keep using my function that computes the extended price given details of the line.

User avatar
Tammy MultiCharts
Posts: 200
Joined: 06 Aug 2020
Has thanked: 6 times
Been thanked: 65 times

Re: Programmatically extending lines without specifying price

Postby Tammy MultiCharts » 28 Apr 2022

Hello all,

There is a known bug when TL_getValue_BN returns 0 when the bar number is outside the range of the line.
This will be fixed in one of the nearest releases. We will notify you here as soon as the fix is out.


Return to “MultiCharts”