Help with formula: day counter and PRINT

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
arnie
Posts: 1594
Joined: Feb 11 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Oct 10 2009

Hi.

I have this simple and little formula that counts the days for each year.

Code: Select all

variables:
stYear (false),
count (0);

if Year(date) <> Year(date)[1] then begin
stYear = true;
count = 0;
end;

if stYear then
count = count + 1;

plot1(count);
What I'd like to know is how can I print the last value of each yearly count?

If I request to print the count variable, all days within the year will be printed, but what I want is to print only the last count for the last day of each year.

Thank you.
Fernando

User avatar
TJ
Posts: 7775
Joined: Aug 29 2006
Location: Global Citizen
Has thanked: 1036 times
Been thanked: 2233 times

Oct 10 2009

what is the chart resolution?

daily chart?

User avatar
arnie
Posts: 1594
Joined: Feb 11 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Oct 11 2009

Hi TJ.

Yes, daily chart.

The same will also be implemented for intraday charts, though the previous formula need to be altered accordingly.

User avatar
TJ
Posts: 7775
Joined: Aug 29 2006
Location: Global Citizen
Has thanked: 1036 times
Been thanked: 2233 times

Oct 13 2009

Hi.

I have this simple and little formula that counts the days for each year.


What I'd like to know is how can I print the last value of each yearly count?

If I request to print the count variable, all days within the year will be printed, but what I want is to print only the last count for the last day of each year.

Thank you.
Fernando
what do you mean by "Print"?

print to PLE log?
print to a file?
print to a printer?
a print on the screen?

how would you like the print out formated?
can you make a mock up sample?

User avatar
TJ
Posts: 7775
Joined: Aug 29 2006
Location: Global Citizen
Has thanked: 1036 times
Been thanked: 2233 times

Oct 13 2009

Hi.

I have this simple and little formula that counts the days for each year.


What I'd like to know is how can I print the last value of each yearly count?

If I request to print the count variable, all days within the year will be printed, but what I want is to print only the last count for the last day of each year.

Thank you.
Fernando

this might be what you are looking for:

Code: Select all

if Year(date) <> Year(date)[1] or LastBarOnChart
then
Plot1( Count [1] );

LastBarOnChart will give you a print on year-to-date number of days.