moving a TL with code problem  [SOLVED]

Questions about MultiCharts and user contributed studies.
jpartner
Posts: 9
Joined: 22 Sep 2013
Has thanked: 2 times

moving a TL with code problem

Postby jpartner » 24 Jan 2015

I have a problem. I have some code that creates two horizontal lines on a chart. When it comes time to move the lines, I use the TL_SetBegin and TL_Set_End functions and supply the functions with a date, time and price. When the lines are redrawn, they are sloped vs. horizontal. It appears that the starting point jumps for some reason as both ending points are identical even though output called after the lines are drawn shows verifies the input data was correct. To complicate this further, during debugging, I decided to call the TL_New function, and draw the same two lines brand new directly after the drawing of the first too using the same input data....and they draw correctly.
Here is the code to move the upper line:

Code: Select all

value1 = tl_setbegin(tl_upper,highs_to_beat_date, highs_to_beat_time, highs_to_beat);
value2 = tl_Setend(tl_upper, highs_to_beat_date,highs_to_beat_time+line_len, highs_to_beat);
Here is the code to move the lower line:

Code: Select all

value1 = tl_setbegin(tl_lower,lows_to_beat_date,lows_to_beat_time, lows_to_beat);
value2 = tl_Setend(tl_lower, lows_to_beat_date, lows_to_beat_time+line_len,lows_to_beat);
Here is the code that draws the new lines correctly - directly after the failed attempts - using the same inputs:

Code: Select all

tl_lower = TL_New(lows_to_beat_date, lows_to_beat_time, lows_to_beat, lows_to_beat_date, lows_to_beat_time+line_len, lows_to_beat);
tl_upper = TL_New(highs_to_beat_date, highs_to_beat_time, highs_to_beat, highs_to_beat_date, highs_to_beat_time+line_len, highs_to_beat);
Here's the image. I am sure I am cross-eyed from trying to debug the code and missing something simple so set me straight.....Thanks in advance!!

Image
Attachments
MC line drawing issue.png
(20.14 KiB) Downloaded 432 times

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

Re: moving a TL with code problem  [SOLVED]

Postby TJ » 24 Jan 2015

Tip:

Move the end first.

jpartner
Posts: 9
Joined: 22 Sep 2013
Has thanked: 2 times

Re: moving a TL with code problem

Postby jpartner » 24 Jan 2015

Tip:

Move the end first.
LOL! I won't even ask why...Thanks!


Return to “MultiCharts”