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 c71eb24

Browse files
authored
Update README.md
1 parent d03c2ef commit c71eb24

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

‎faq_and_code/README.md‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ One solution is to force a rounding of OHLC built-ins and use the rounded values
105105
```js
106106
//@version=4
107107
study("My Script", overlay = true, precision = 10)
108-
f_roundToTick( _price) => round(_price / syminfo.mintick) * syminfo.mintick
109-
o = f_roundToTick(open)
110-
c = f_roundToTick(close)
108+
o = round_to_mintick(open)
109+
c = round_to_mintick(close)
111110
bgcolor(o == c and open != close ? color.red : na)
112111
plotchar(o, "o", "", location.top, size = size.tiny)
113112
plotchar(c, "c", "", location.top, size = size.tiny)
@@ -118,15 +117,13 @@ plotchar(close, "close", "", location.top, size = size.tiny)
118117

119118
You can also use this version of the function which returns rounded OHLC values in a single call:
120119
```js
121-
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
122-
// © PineCoders
123-
124120
//@version=4
125-
study("My Script", precision = 8)
126-
f_ohlcRoundedToTick() => [round(open / syminfo.mintick) * syminfo.mintick, round(high / syminfo.mintick) * syminfo.mintick, round(low / syminfo.mintick) * syminfo.mintick, round(close / syminfo.mintick) * syminfo.mintick]
121+
study("", precision = 8)
122+
f_roundedToTickOHLC() =>
123+
[round_to_mintick(open), round_to_mintick(high), round_to_mintick(low), round_to_mintick(close)]
127124
f_color(_v1, _v2) => _v1 != _v2 ? color.red : color.blue
128125

129-
[o, h, l, c] = f_ohlcRoundedToTick()
126+
[o, h, l, c] = f_roundedToTickOHLC()
130127

131128
plotchar(o, "o", "", location.top, f_color(o, open))
132129
plotchar(open, "open", "", location.top, f_color(o, open))

0 commit comments

Comments
(0)

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