TrendLine created, not displayed  [SOLVED]

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

TrendLine created, not displayed

Postby arjfca » 07 May 2013

Hello

I want to draw horizontal trendline to show the previous Day High & Day Low on my 250 Ticks chart.. The trend line does not appear on my chart and I don't know why

A trendline number is created and is re-use everytime. One Line number per High and one per low.

The value of the last day High and low is also show on the datawindow using the last line ot this actual code. The good values are displayed.

Trendline creation:

Code: Select all

once If barnumber =1 then begin
NameInstrument = GetSymbolName;

LineNumHigh = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
LineNumLow = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
Print ("First step ", LineNumHigh:0:0, " ", LineNumLow:0:0);
Value1=TL_SetExtRight(LineNumHigh,True); // Extend to the right
Value1=TL_SetExtRight(LineNumLow,True); // Extend to the right
Value1=TL_SetExtLeft(LineNumHigh,True); // Extend to the left
Value1=TL_SetExtLeft(LineNumLow,True); // Extend to the right



Value1 = TL_SetColor(LineNumHigh,Blue);
Value1 = TL_SetColor(LineNumLow,Red);
Value1 = TL_SetSize(LineNumHigh,2);
Value1 = TL_SetSize(LineNumLow,2);
Now, Look for the last day High and Low and show it

Code: Select all

If testLastDayHighLow = true then begin

If barstatus[1] = 2 then begin
If SessionLastBar[1] then begin
Dated = date[1];
TimeD = Time_s[1];
HighOfTheDay = Dayhigh;
LowOfTheDay = DayLow;

Value1 = tl_setbegin(LineNumHigh,dateD,timeD,HighOfTheDay);
Value1 = TL_SetEnd(LineNumHigh,dateD,timeD,HighOfTheDay);
Value1 = tl_setbegin(LineNumLow,dateD,timeD,LowOfTheDay);
Value1 = TL_SetEnd(LineNumLow,dateD,timeD,LowOfTheDay);
Print ("LN ", LineNumHigh:0:0, " ", dateD:0:0, " ", Timed:0:0, " ", Highoftheday:5:5);
DayLow = 999999;
DayHigh = 0;

end;

If High[1] > DayHigh then DayHigh = High[1];
If Low[1] < DayLow then DayLow = Low[1];

end;
end;


Plot1(HighOfTheDay,"Previous Day High");
Plot2(LowOfTheDay,"Previous Day Low");
Martin

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: TrendLine created, not displayed

Postby bowlesj3 » 07 May 2013

I have on rare occasion had trend lines not show. I check the location of the date and time in the properties for the line but they simply are not showing. I check the color and they should be visible but they are not. It is pretty rare (maybe once every 3 months). 99.999% of the time there is no problem.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: TrendLine created, not displayed

Postby arjfca » 07 May 2013

I have on rare occasion had trend lines not show. I check the location of the date and time in the properties for the line but they simply are not showing. I check the color and they should be visible but they are not. It is pretty rare (maybe once every 3 months). 99.999% of the time there is no problem.
OK
Is it with tick charts or the regular one?
Is the trendline as to be re-enabled on every pass or once per day is sufficient

Have a good day John
Martin

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: TrendLine created, not displayed

Postby bowlesj3 » 07 May 2013

Hi Martin,

In my case I seem to remember it being the 1 minute bars (I don't use tick charts). I do not remember exactly how the trend line was originally put there (By the program I think). I have seen this occur maybe 5 or 6 times. It is not something I can recreate at any time. It occurs totally randomly.

John

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

Re: TrendLine created, not displayed

Postby TJ » 07 May 2013

My charts have all sorts of trendlines and arrows and texts on them. I have used all kinds of methods to draw them, move them, delete them, hide them, resurrect them, changing attributes, etc., I have pretty well tested all coding permutations, and satisfied that there is no bugs in MultiCharts drawing objects. If you found there is something that doesn't work, I would be happy to go through your codes with you.

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

Re: TrendLine created, not displayed

Postby TJ » 07 May 2013

Hello

I want to draw horizontal trendline to show the previous Day High & Day Low on my 250 Ticks chart.. The trend line does not appear on my chart and I don't know why
...
Martin
Try:

tl_setbegin_s
TL_SetEnd_s

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: TrendLine created, not displayed

Postby arjfca » 08 May 2013

Hello

I want to draw horizontal trendline to show the previous Day High & Day Low on my 250 Ticks chart.. The trend line does not appear on my chart and I don't know why
...
Martin
Try:

tl_setbegin_s
TL_SetEnd_s
Thanks TJ, it resolved in part the problem

Now, A trendline is visible, but not in an horizontal line. Both High and Low should represent the value of the previous day session

I took a snap picture. and I show the actual line created by the code in Red (Low) , Blue(High). I also draw the position of the expected High and Low

My code use the same value for the TL_SetBegin_S & TL_SetEnd_S. So I should expect an horizontal line, not an angled one

Martin :)

Code: Select all


once If barnumber =1 then begin
NameInstrument = GetSymbolName;

LineNumHigh = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
LineNumLow = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
Print ("First step ", LineNumHigh:0:0, " ", LineNumLow:0:0);
Value1=TL_SetExtRight(LineNumHigh,True); // Extend to the right
Value1=TL_SetExtRight(LineNumLow,True); // Extend to the right
Value1=TL_SetExtLeft(LineNumHigh,True); // Extend to the left
Value1=TL_SetExtLeft(LineNumLow,True); // Extend to the right



Value1 = TL_SetColor(LineNumHigh,Blue);
Value1 = TL_SetColor(LineNumLow,Red);
Value1 = TL_SetSize(LineNumHigh,2);
Value1 = TL_SetSize(LineNumLow,2);
end;


If testLastDayHighLow = true then begin
If barstatus[1] = 2 then begin
If SessionLastBar[1] then begin
Dated = date[1];
TimeD = Time_s[1];
HighOfTheDay = Dayhigh;
LowOfTheDay = DayLow;

Value1 = TL_setbegin_S(LineNumHigh,dateD,timeD,HighOfTheDay);
Value1 = TL_SetEnd_S(LineNumHigh,dateD,timeD,HighOfTheDay);
Value1 = TL_setbegin_S(LineNumLow,dateD,timeD,LowOfTheDay);
Value1 = TL_SetEnd_S(LineNumLow,dateD,timeD,LowOfTheDay);
Print ("LN ", LineNumHigh:0:0, " ", dateD:0:0, " ", Timed:0:0, " ", Highoftheday:5:5, " LOw ", Lowoftheday:5:5);
DayLow = 999999;
DayHigh = 0;

end;

If High[1] > DayHigh then DayHigh = High[1];
If Low[1] < DayLow then DayLow = Low[1];

end;
end;
Result from the print command show the high and low of preceding day's. They are good values.
LN 19 1130425 165635 High 1.30935 LOw 1.29885
LN 19 1130426 165734 High 1.30475 LOw 1.29905
LN 19 1130429 165717 High 1.31165 LOw 1.30255
LN 19 1130430 165325 High 1.31860 LOw 1.30540
LN 19 1130501 165545 High 1.32425 LOw 1.31605
LN 19 1130502 165430 High 1.32185 LOw 1.30370
LN 19 1130503 165402 High 1.31595 LOw 1.30325
LN 19 1130506 165324 High 1.31410 LOw 1.30535
LN 19 1130507 165633 High 1.31320 LOw 1.30675
Attachments
DayHigh & DayLow.png
(44.13 KiB) Downloaded 1107 times

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: TrendLine created, not displayed

Postby bowlesj3 » 08 May 2013

My charts have all sorts of trendlines and arrows and texts on them. I have used all kinds of methods to draw them, move them, delete them, hide them, resurrect them, changing attributes, etc., I have pretty well tested all coding permutations, and satisfied that there is no bugs in MultiCharts drawing objects. If you found there is something that doesn't work, I would be happy to go through your codes with you.
In my situation (if you read my first post very carefully) the only way for it not to be an MC problem is if windows overlays some of the MC code after it has been loaded (I am not sure if Windows will allow other programs to address outside their boundaries and adjust the code of other running programs after they have been loaded). Next time I may go on the chat to demo it. Martin can use the attributes of the line (assuming he can find the line number) to figure out where the line is suppose to appear then can position the chart to see if it is actually there (assuming it is a visible color). That is what I do if I have a bug now and I can not find the line. I find the number and check to see if it is my problem or an MC(possibly windows problem). If it is an MC/Windows problem restarting MC is required for an immediate fix (just like at times a restart of the machine is required). We all have to do this because we do not have time to sit on the phone for 3 hours helping them to find a fix which just may not be their problem anyway (time is money, pay me $300 per hour and I will do it).

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

Re: TrendLine created, not displayed

Postby TJ » 08 May 2013

Hello
I want to draw horizontal trendline to show the previous Day High & Day Low on my 250 Ticks chart.. The trend line does not appear on my chart and I don't know why
...
Martin
Try:
tl_setbegin_s
TL_SetEnd_s
Thanks TJ, it resolved in part the problem
Now, A trendline is visible, but not in an horizontal line. Both High and Low should represent the value of the previous day session
....
May I refresh your memory:
viewtopic.php?f=1&t=10514

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: TrendLine created, not displayed: Resolved???

Postby arjfca » 08 May 2013

Hello Jonathan / John

I did reolved the problem, but for a strange reason.

I did use John suggestion and I looked at the trendline format. Strangely, the format for the trendline was from a start from the actual, calculated from the code, High and time, but the end was from the previous value..

To make a straight line, my code use the same value for the Start and the end.

Code: Select all

Value1 = TL_setbegin_S(LineNumHigh,dateD,timeD,HighOfTheDay);
Value1 = TL_SetEnd_S(LineNumHigh,dateD,timeD,HighOfTheDay);

Value1 = TL_setbegin_S(LineNumLow,dateD,timeD,LowOfTheDay);
Value1 = TL_SetEnd_S(LineNumLow,dateD,timeD,LowOfTheDay);
What I did, I inverted the SetBegin SetEnd. Now, trend line is OK.

I did not known that the Begin And End as to be in a special order

Code: Select all


Value1 = TL_SetEnd_S(LineNumHigh,dateD,timeD,HighOfTheDay);
Value1 = TL_setbegin_S(LineNumHigh,dateD,timeD,HighOfTheDay);

Value1 = TL_SetEnd_S(LineNumLow,dateD,timeD,LowOfTheDay);
Value1 = TL_setbegin_S(LineNumLow,dateD,timeD,LowOfTheDay);
Martin
Attachments
High & Low.png
(45.76 KiB) Downloaded 1078 times
Trendline characteristics.png
(29.94 KiB) Downloaded 1103 times

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

Re: TrendLine created, not displayed: Resolved???

Postby TJ » 08 May 2013

Hello Jonathan / John
....
I did not known that the Begin And End as to be in a special order
Martin
There is no rule to set the Begin and End in a special order,
you only have to apply them in the logic you want.
Computer is dumb; it only does things the way you instruct them to do.
viewtopic.php?f=1&t=10326

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: TrendLine created, not displayed: Resolved???  [SOLVED]

Postby arjfca » 08 May 2013

Hello Jonathan / John
....
I did not known that the Begin And End as to be in a special order
Martin
There is no rule to set the Begin and End in a special order,
you only have to apply them in the logic you want.
Computer is dumb; it only does things the way you instruct them to do.
viewtopic.php?f=1&t=10326
Thanks for the link about the topic
Better understanding now.

Martin

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

Re: TrendLine created, not displayed

Postby TJ » 08 May 2013

a few more coding notes:

Code: Select all

once If barnumber =1 then begin
You do not need to check if barnumber =1. ONCE is always executed once at the beginning.

Code: Select all

Value1=TL_SetExtRight(LineNumLow,True); // Extend to the right
You do not need to assign to Value1.
You assign to a variable only if you need to refer to the status of this ID at a later point.
You can code it as:

Code: Select all

TL_SetExtRight(LineNumLow,True); // Extend to the right
Hope the above helps.


Return to “MultiCharts”