Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions guides/code_style/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

![logo](../../pinelong.png "Pine")
![logo](../../images/pinelong.png "Pine")

# Pine Script Coding Conventions

Expand All @@ -8,10 +8,14 @@
The goal of these Coding Conventions is to present a set of best practices and style guidelines for Pine Script. By making Pine scripts easier to read, these guidelines make open source code more readable, while also providing safeguards that minimize the risk of errors for developers.

### Translations

1. [TODO](#)

### Table of Contents
1. [TODO](#)

1. [Script Structure](#script-structure)
1. [Naming Conventions](#naming-conventions)
1. [Line Wrapping](#line-wrapping)

## Script Structure

Expand All @@ -38,28 +42,32 @@ Here is an example of a complete script:
```
code
```

**[Back to top](#table-of-contents)**

## Naming Conventions

### Variable and Function Names

CamelCase is recommmended. Example: `emaLength`, `obLevel`, `showSignal2`, `aLongVariableName`.
CamelCase is recommended. Example: `emaLength`, `obLevel`, `showSignal2`, `aLongVariableName`.

### Function Parameter Names

Function parameters should be prefixed with the underscore in order to diffentiate them from global and local scope variables. Example:
Function parameters should be prefixed with the underscore in order to differentiate them from global and local scope variables. Example:
```
daysInMonth( _year, _month) =>
daysInMonth(_year, _month) =>
```

### Local Scope Variable Names

> Do we need something here, to prevent inadvertent confusion with global scope vars?

**[Back to top](#table-of-contents)**

## Line Wrapping

When lines need to be continued on the next, use two spaces to indent the continuation line.


**[Back to top](#table-of-contents)**

# TODO
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes.
46 changes: 15 additions & 31 deletions snippets/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,66 @@

#### Description:

Description of the template snippet name snippet.
Place description of your snippet here.

##### References:
* [link1](http:\\alinktonowhere.come "descriptionoflinktonowhere.")

* [Link](http:\\alinktonowhere.come "description_of_link")

#### Code:

<details open>
<!-- leave a blank line after summary -->
<summary>pine version = 4:</summary>
<summary>@version=4:</summary>

```
//-----------------
// example snippet code:
// pine version=4
f_phi() =>
float _phi = 0,5 + sqrt(1,25)
float _phi = 0.5 + sqrt(1.25)
_phi
//-----------------
```
</details>

<details close>
<!-- leave a blank line after summary -->
<summary>pine version = 2:</summary>
<summary>@version=2:</summary>

<!-- -->
<!-- code goes between the backticks: -->
```javascript
//-----------------
// example snippet code:
// pine version=2
f_phi() =>
_phi = 0,5 + sqrt(1,25)
_phi = 0.5 + sqrt(1.25)
_phi
//-----------------
```
```
</details>

#### Example:


Description of the example, <br/>
use the phi function and multiply by 2, <br/>
this is more text....
Place description of the example here.<br/>

<details open>
<!-- leave a blank line after summary -->
<summary>Example Code:</summary>
<!--<summary>Code:</summary> -->

<!-- -->
<!-- code goes between the backticks: -->
```javascript
//@version=4
study("Function - PHI")
study("Function - Golden Ratio")

//-----------------
// example snippet code:
f_phi() =>
float _phi = 0,5 + sqrt(1,25)
float _phi = 0.5 + sqrt(1.25)
_phi
//-----------------

example = f_phi() * 2
plot(series=example, title='example', color=color.red)
plot(series=example, title="Example", color=color.red)

```
</details>

##### Code Author(s):
* ##### [Author](http:\\linkifavaiable "@tooltip.")
* [Author](http:\\linkifavaiable "@nickname")

<br/>
<br/>
<br/>

[Disclaimer](/./DISCLAIMER.md "Disclaimer.")<br/>
[License](/./LICENSE "License.")
[Disclaimer](/./DISCLAIMER.md "Disclaimer")<br/>
[License](/./LICENSE "License")
Empty file removed tricks/.gitkeep
Empty file.