PL equivalent of  [SOLVED]

Questions about MultiCharts and user contributed studies.
tonyt
Posts: 48
Joined: 21 May 2021
Has thanked: 20 times
Been thanked: 1 time

PL equivalent of  [SOLVED]

Postby tonyt » 25 Jan 2022

if I want to increment a 'trade day' counter at from 0 at the start of every year, how would I best accomplish this? The idea is to count the trading days of the year only.

Easy Language has the BarDateTime.Year function so I can write it like this:

Code: Select all

if bardatetime.year <> bardatetime[1].year then Begin DayOfYearCounter = 1; end else if bardatetime.Day <> bardatetime[1].Day then DayOfYearCounter += 1;
what's the best reserved word to accomplish this in PL?

Thank you!

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

Re: PL equivalent of

Postby TJ » 25 Jan 2022

Try this:

Code: Select all

Once Begin If YEAR > YEAR[1] then DayOfYearCounter = 0; END; If DATE > DATE[1] then DayOfYearCounter = DayOfYearCounter +1;


Return to “MultiCharts”