Script using BARDATE

Hi, I’ve created a script using the BARDATE() function, which helps me visualise a period. On my computer, works correctly, and shows a value between 0 and 360, I have sent the same script to my friends, for some of them it shows only a straight horizontal line. Which setting might have impact on the following calculation?

offs1=281,02;

v5 = offs1 + BARDATE()*360/365,259635864;

v6 = v5/360;

v7 = ROUND(v6, DECIMALTYPE=0);

v8 = v6-v7;

v9 = v8*360;

v10 = (v8+1)*360;

v11 = IF(v7<v6,v9,v10);

plot1= v11

Thank you in advance

period_script.jpg

Hi Vilmos

The reason for the difference in the script plots is that you are using a comma (“,”) as the decimal separator, rather than the period (".'). When I change the comma to a period in the following code lines the script display as you expected.

offs1=281.02;

v5 = offs1 + BARDATE()*360/365.259635864;

This displays on my laptop as:

20190908 Vilmos 1

While you script as originally presented looks like this:

20190908 Vilmos 2

A trap for us all when transferring data across country borders.

Cheers

Trevor

 

 

 

Thank you Trevor. Issue is solved.

It would be very helpful to see the next period not only the past and current one. As it depend only on BARDATE it should be possible to calculate for the future.

Do you know any settings for display the periods for the future?

Thank you

Hi Vilmos,

I cannot see how you can calculate a script plot to display into the future as the way I understand how Optuma works, the SHOWVIEW’s plot time scale is related to the bars on the chart, not the time scale along the bottom of the chart. It seems to me that you would need to be able to increment the BARDATE number in some way, which I don’t believe is possible Optuma Scripter.

If you are into Pascal programming it may be possible to develop the necessary code using the Optuma Custom Tool Manager if you have the Optuma Programming Module.

Cheers

Trevor