Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4fe7305

Browse files
authored
Update README.md
1 parent d7c944c commit 4fe7305

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎faq_and_code/README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,24 @@ f_print(_text) => var table _t = table.new(position.middle_right, 1, 1), table.c
15801580
f_print(countDown)
15811581
```
15821582

1583+
### How can I get the weeek of the month?
1584+
This code uses changes in the week of the year to determine the week of the month:
1585+
1586+
```js
1587+
//@version=5
1588+
//@author=Bjorgum, for PineCoders
1589+
indicator("weekOfMonth()")
1590+
weekOfMonth(timestamp = time) =>
1591+
var week = weekofyear(timestamp) %4
1592+
if ta.change(weekofyear(timestamp))
1593+
week += 1
1594+
if ta.change(month(timestamp))
1595+
week := 1
1596+
int result = timeframe.ismonthly ? na : week
1597+
1598+
plot(weekOfMonth())
1599+
```
1600+
15831601
**[Back to top](#table-of-contents)**
15841602

15851603

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /