We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 013e6e9 commit a803634Copy full SHA for a803634
faq_and_code/README.md
@@ -1568,6 +1568,17 @@ f_nthDayofweekInMonth(_nth, _dayNo) =>
1568
plotchar(f_nthDayofweekInMonth(i_nth, i_dayNo), "Day", "•", location.top, size = size.tiny)
1569
```
1570
1571
+### How can I implement a countdown timer?
1572
+This code will work at intraday timeframes and at 1D. It would require more discerning logic for it to work on timeframes higher than that:
1573
+
1574
+```js
1575
+//@version=4
1576
+study("Countdown", "", true)
1577
+int timeLeftInBar = (timeframe.isdaily and timeframe.multiplier == 1) or timeframe.isintraday ? (time_close - time) - (timenow - time) : 0
1578
+string countDown = str.format("{0,time,HH:mm:ss}", timeLeftInBar)
1579
+f_print(_text) => var table _t = table.new(position.middle_right, 1, 1), table.cell(_t, 0, 0, _text, bgcolor = color.yellow)
1580
+f_print(countDown)
1581
+```
1582
1583
**[Back to top](#table-of-contents)**
1584
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments