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: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Help with formula: day counter and PRINT

Postby arnie » 10 Oct 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: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 10 Oct 2009

what is the chart resolution?

daily chart?

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

Postby arnie » 11 Oct 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: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Help with formula

Postby TJ » 13 Oct 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: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Help with formula

Postby TJ » 13 Oct 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.


Return to “User Contributed Studies and Indicator Library”