Positioning error text on the chart on Monday  [SOLVED]

Questions about MultiCharts and user contributed studies.
fibdax
Posts: 155
Joined: 03 Jan 2011
Has thanked: 10 times
Been thanked: 6 times

Positioning error text on the chart on Monday

Postby fibdax » 26 Jan 2015

text_setlocation (value, date- 1,0900 , lowd ( 1 ) ) on Monday is not working properly
is a bug ?
see gif
Attachments
bug pos monday.JPG
(178.67 KiB) Downloaded 401 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Positioning error text on the chart on Monday

Postby JoshM » 26 Jan 2015

text_setlocation (value, date- 1,0900 , lowd ( 1 ) ) on Monday is not working properly
Because Date is in YYYMMdd format, it doesn't lend itself for arithmetic operations like subtracting 1. For example, if the date is 1 January 2015 (1150101), subtracting 1 gives 1150100, which would be the 0th of January.

You'll need to use DateTime for date & time calculations, like so:

Code: Select all

Variables:
value(0),
dateValue(0);

dateValue = JulianToDate(DateTime - 1);

Text_SetLocation(value, dateValue, 900, lowd(1));

fibdax
Posts: 155
Joined: 03 Jan 2011
Has thanked: 10 times
Been thanked: 6 times

Re: Positioning error text on the chart on Monday

Postby fibdax » 26 Jan 2015

thanks for the reply , I have changed the code but the result is the same see gif.
If I change the day and insert the code works on Friday 01/23/2015 and so on except Monday.
Attachments
bug pos fr.JPG
(72.92 KiB) Downloaded 389 times
bug pos monday new code.JPG
(157.9 KiB) Downloaded 394 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Positioning error text on the chart on Monday

Postby JoshM » 26 Jan 2015

thanks for the reply , I have changed the code but the result is the same see gif.
If I change the day and insert the code works on Friday 01/23/2015 and so on except Monday.
Should the text "Monday" be placed at the first bar of Monday or at the very last bar?

In your indicator the following code occurs:

Code: Select all

value60 = Text_New(date, 1730, close, text("Monday"));
...
value6 = text_setlocation(value60, date, time+150, highd(0));
This would place the text "Monday" 1 hour and 50 minutes further away from the current bar's time. That can explain why the midpoint of the text "Monday" hovers around 12.30-12.45 on your chart. If you want "Monday" to appear at a fixed time (like 1730) I think you need to replace the `time + 150` part.

Or do you mean something else with 'the code doesn't work on Monday'?

fibdax
Posts: 155
Joined: 03 Jan 2011
Has thanked: 10 times
Been thanked: 6 times

Re: Positioning error text on the chart on Monday  [SOLVED]

Postby fibdax » 26 Jan 2015

I solved the problem thanks to your help . sorry for my english
the text should be positioned at 0900 the previous day
Attachments
solution.JPG
(171.21 KiB) Downloaded 395 times


Return to “MultiCharts”