Skip to content

Commit 63992fd

Browse files
authored
Update README.md
1 parent 68dee2f commit 63992fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

coding_conventions/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ The goal of these Coding Conventions is to present a set of best practices and s
2828

2929
The Pine compiler is not very strict on exact positioning of specific statements or compiler directives. While many other arrangements are syntactically correct, these guidelines aim to provide a standard way of ordering elements in scripts:
3030

31-
1. The first line of a script should be the `//@version=X` compiler directive, where `X` is replaced by the version of Pine the script is written for. While the compiler defaults to Pine version 1 when no directive is used, scripts written using version 1 of Pine should nonetheless contain the `//@version=1` directive on their first line.
31+
1. The first line of a script should be the [``//@version=X``](https://www.tradingview.com/pine-script-docs/en/v4/language/Versions.html) compiler directive, where `X` is replaced by the version of Pine the script is written for. While the compiler defaults to Pine version 1 when no directive is used, scripts written using version 1 of Pine should nonetheless contain the `//@version=1` directive on their first line.
3232

3333
1. **Comments** describing the script are usually placed immediately after the `@version` compiler directive.
3434

35-
1. The first Pine statement in the script should be either the `study()` or `strategy()` declaration statement.
35+
1. The first Pine statement in the script should be either the [``study()``](https://www.tradingview.com/pine-script-reference/v4/#fun_study) or [``strategy()``](https://www.tradingview.com/pine-script-reference/v4/#fun_strategy) declaration statement.
3636

3737
1. The next lines should contain the following sections, properly identified if they are long:
3838

@@ -85,7 +85,7 @@ plot(signal, color = color.orange)
8585

8686
### Constants
8787

88-
Constants are variables whose value will not change during script execution. Use all caps snake case for constants, and declare them using the `var` keyword so they are only initialized when the script executes at bar zero, when [``barstate.isfirst``](https://www.tradingview.com/pine-script-reference/v4/#var_barstate{dot}isfirst) is true. Example:
88+
Constants are variables whose value will not change during script execution. Use all caps snake case for constants, and declare them using the [``var``](https://www.tradingview.com/pine-script-reference/v4/#op_var) keyword so they are only initialized when the script executes at bar zero, when [``barstate.isfirst``](https://www.tradingview.com/pine-script-reference/v4/#var_barstate{dot}isfirst) is true. Example:
8989

9090
```js
9191
// ———————————————————— Constants {
@@ -116,7 +116,7 @@ We recommend using camelCase for variable names. Example: `emaLength`, `obLevel`
116116

117117
For large projects, you may find it useful to use prefixes for a few types of variables, to make them more readily identifiable. The following prefixes can then be used:
118118

119-
- `i_` for variables initialized through `input()` calls.
119+
- `i_` for variables initialized through [``input()``](https://www.tradingview.com/pine-script-reference/v4/#fun_input) calls.
120120
- `c_` for variables containing colors.
121121
- `p_` for variables used as [``plot()``](https://www.tradingview.com/pine-script-reference/v4/#fun_plot) or [``hline()``](https://www.tradingview.com/pine-script-reference/v4/#fun_hline) identifiers in [``fill()``](https://www.tradingview.com/pine-script-reference/v4/#fun_fill) calls.
122122
- All caps for constants, i.e., variables often initialized at the beginning of scripts whose value will not change during execution.

0 commit comments

Comments
 (0)