├── .gitignore ├── CHANGELOG.md ├── README.md ├── images ├── ext1.gif ├── ext2.gif ├── ext3.gif ├── ext4.gif ├── header.png ├── hovers.gif ├── pineicon.png ├── smtb.png ├── syntax.gif └── syntax.png ├── language-configuration.json ├── package-lock.json ├── package.json ├── snippets ├── built-in_functions.json ├── built-in_language_operators.json ├── built-in_scripts.json ├── built-in_variables_dictionnary.json ├── comments.json ├── ect.json ├── f.json ├── loopscounters.json ├── principals.json ├── scripts_add.json ├── unicode.json └── words.json ├── src ├── extension.ts ├── test │ ├── runTest.ts │ └── suite │ │ ├── extension.test.ts │ │ └── index.ts └── variables.ts └── syntaxes ├── index.schema.json └── ps.tmLanguage.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | snippets/ 3 | images/ 4 | CHANGELOG.md 5 | package-lock.json 6 | package.json 7 | README.md 8 | 9 | 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | 4 | #### **1.0.1** 5 | 6 | *25.11.2021 **Update*** 7 | - Hover Reference provider 8 | - Deleted domain snippets `info` 9 | - Corrected few snippets 10 | - Added snippets under `f` domain 11 | 12 | **Hovers Not Working** 13 | * After udating if the hovers don't work 14 | * 1. Unistall the extension 15 | * 2. Open .vscode file from explorer or finder, or execute `open .vscode` in the terminal 16 | * 3. Delete jeylaniB.pinescript extension folder 17 | * 4. Reinstall the extension 18 | 19 | --- 20 | 21 | #### **1.0.0** 22 | - Extension Release 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

Pine Script V5

3 |

⭐ Syntax Highlighting | Snippets | Hovers ⭐

4 | 5 | ### **Update** 6 | 7 | * Language Reference Hovers 8 | 9 | #### **Realease Info** 10 | 11 | * Complementary Pine Editor Themes extension is available **[here](https://marketplace.visualstudio.com/items?itemName=JeylaniB.pine-editor-themes)** 12 | 13 | --- 14 | 15 | #### **Syntax** 16 | 17 | 18 | 19 | --- 20 | 21 | #### **Hovers** 22 | 23 | 24 | 25 | --- 26 | 27 | #### **Snippets** 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | --- 36 | 37 | | Snippets Info | | | | Supported File Extension | 38 | | ----------------- | :------: | - | - | :----------------------- | 39 | | function | `𝑓 ` | | | `.help` | 40 | | variable | `𝑥 ` | | | `.ps` | 41 | | script | `𝑓𝑥` | | | `.pine` | 42 | | language operator | `⟗ ` | | | `.pinecode` | 43 | | comment | `//` | | | `.script` | 44 | | reference url | `ⓘ` | | | `.tdps` | 45 | | info date\|time | `🧭 ` | | | `.trading` | 46 | | unicode | `U ` | | | `.tradingview` | 47 | 48 | --- 49 | 50 | ### **Prefix's** 51 | 52 | | *Domains* | | *Language Words* | *Shortcut Snippet* | 53 | | --------------------------- | :-: | ----------------------------------- | -------------------- | 54 | | `all built-in variables ` | | `alert_message` | `ln` | 55 | | `all built-in functions ` | | `backtest_fill_limits_assumption` | `bx` | 56 | | `operator\|op ` | | `bordercolor` | | 57 | | `variable ` | | `calc_on_order_fills` | | 58 | | `function ` | | `char` | | 59 | | `script\|s` | | `close_entries_rule` | | 60 | | `f ` | | `color` | | 61 | | `comment ` | | `comment` | | 62 | | `/ ` | | `commission_type` | | 63 | | `// ` | | `currency` | | 64 | | `info ` | | `default_qty_type` | | 65 | | `unicode ` | | `defval` | | 66 | | `library` | | `display` | | 67 | | | | `editable` | | 68 | | | | `explicit_plot_zorder` | | 69 | | | | `export\|library.function` | | 70 | | | | `field` | | 71 | | | | `format` | | 72 | | | | `formatString` | | 73 | | | | `freq` | | 74 | | | | `from_entry` | | 75 | | | | `gaps` | | 76 | | | | `group` | | 77 | | | | `ignore_invalid_symbol ` | | 78 | | | | `import` | | 79 | | | | `inline` | | 80 | | | | `join` | | 81 | | | | `linestyle` | | 82 | | | | `location` | | 83 | | | | `lookahead` | | 84 | | | | `message` | | 85 | | | | `order` | | 86 | | | | `overlay` | | 87 | | | | `position` | | 88 | | | | `process_orders_on_close` | | 89 | | | | `scale` | | 90 | | | | `separator` | | 91 | | | | `shorttitle` | | 92 | | | | `size` | | 93 | | | | `style` | | 94 | | | | `textalign` | | 95 | | | | `text_halign` | | 96 | | | | `text_size` | | 97 | | | | `text_valign` | | 98 | | | | `ticker` | | 99 | | | | `timeframe` | | 100 | | | | `timezone` | | 101 | | | | `title` | | 102 | | | | `tooltip` | | 103 | | | | `trackprice` | | 104 | | | | `wickcolor` | | 105 | | | | `xloc` | | 106 | | | | `version` | | 107 | 108 | --- 109 | 110 | ### Roadmap 111 | 112 | 1. Updating `f` and `script` domains 113 | 2. Implementing hover informations ✅ 114 | 3. Implementing intellisense autocompletion 115 | 116 | --- 117 | 118 | ### **Hover Issue** 119 | 120 | * After udating if the hovers don't work 121 | 122 | * 1. Unistall the extension 123 | * 2. Open .vscode file from explorer or finder, or execute `open .vscode` in the terminal 124 | * 3. Delete jeylaniB.pinescript folder 125 | * 4. Reinstall the extension 126 | 127 | --- 128 | 129 | ### Contributions 130 | 131 | - If you want to report an error, snippet suggestion, script to add or anything else [pull request](https://github.com/jeyllani/pinescript/pulls) 132 | 133 | --- 134 | 135 | ### Support Us 136 | 137 | - If you find this extension useful and want to support it 138 | 139 | * **BTC** *13tRgbSFSLEgNzdQt21THir8afuqYVi1pA* 140 | * **ETH** *0x768d0068989f68ccdabcbae8256e9d7d7a48ff98* 141 | * **ADA** *DdzFFzCqrhsxjjPrRKZtjayLJ9bCzbdCm82J2zbhE63EB1sGYJdp3R6mLkEyQSTmFhSJsHW6rNDHZx4M77p9LwmvrCLxMhwW2yxZ1Auw* 142 | * **LTC** *LMGsFqKo6rKXncEc3hb1Rxd2WWiHUJmf8E* 143 | * **XMR** *89GRBG7HrqSGMRjsPPo4W7HcEeqVpgB7UMttaGPEr9KJEwzDqq7vmxci9k7VmhcqUpWAvs2TE7qqgAMZVTX4pnAM97UAZi4* 144 | 145 | --- 146 | 147 | ##### Version 148 | 149 | *3.0.1* 150 | -------------------------------------------------------------------------------- /images/ext1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/ext1.gif -------------------------------------------------------------------------------- /images/ext2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/ext2.gif -------------------------------------------------------------------------------- /images/ext3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/ext3.gif -------------------------------------------------------------------------------- /images/ext4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/ext4.gif -------------------------------------------------------------------------------- /images/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/header.png -------------------------------------------------------------------------------- /images/hovers.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/hovers.gif -------------------------------------------------------------------------------- /images/pineicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/pineicon.png -------------------------------------------------------------------------------- /images/smtb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/smtb.png -------------------------------------------------------------------------------- /images/syntax.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/syntax.gif -------------------------------------------------------------------------------- /images/syntax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeyllani/pinescript/19bf6e580f6fe903fd7ffd0635795cce6c1b5c5d/images/syntax.png -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "// # ", 4 | "blockComment": [ "// # ", "// # " ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"], 8 | ["[", "]"], 9 | ["(", ")"] 10 | ], 11 | "autoClosingPairs": [ 12 | ["{", "}"], 13 | ["[", "]"], 14 | ["(", ")"], 15 | ["\"", "\""], 16 | ["'", "'"] 17 | ], 18 | "surroundingPairs": [ 19 | ["{", "}"], 20 | ["[", "]"], 21 | ["(", ")"], 22 | ["\"", "\""], 23 | ["'", "'"] 24 | ] 25 | 26 | } 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pinescript", 3 | "displayName": "Pine Script", 4 | "description": "Pine Script V5 Syntax Highlighting & Snippets", 5 | "icon": "images/pineicon.png", 6 | "publisher": "JeylaniB", 7 | "license": "MIT", 8 | "version": "3.0.1", 9 | "engines": { 10 | "vscode": "^1.62.0" 11 | }, 12 | "author": { 13 | "name": "Jeylani" 14 | }, 15 | "categories": [ 16 | "Language Packs", 17 | "Programming Languages" 18 | ], 19 | "keywords": [ 20 | "pine", 21 | "pinescript", 22 | "Pine Script V5", 23 | "pine script", 24 | "pinecode", 25 | "pine code", 26 | "pineeditor", 27 | "pine editor", 28 | "tradingview", 29 | "trade", 30 | "trading" 31 | ], 32 | "activationEvents": [ 33 | "onLanguage:pine", 34 | "onCommand:myExtension.sayHello" 35 | ], 36 | "main": "./dist/extension.js", 37 | "contributes": { 38 | "commands": [ 39 | { 40 | "command": "myExtension.sayHello", 41 | "title": "Say Hello" 42 | } 43 | ], 44 | "snippets": [ 45 | { 46 | "language": "pine", 47 | "path": "./snippets/built-in_language_operators.json" 48 | }, 49 | { 50 | "language": "pine", 51 | "path": "./snippets/built-in_functions.json" 52 | }, 53 | { 54 | "language": "pine", 55 | "path": "./snippets/built-in_variables_dictionnary.json" 56 | }, 57 | { 58 | "language": "pine", 59 | "path": "./snippets/built-in_scripts.json" 60 | }, 61 | { 62 | "language": "pine", 63 | "path": "./snippets/comments.json" 64 | }, 65 | { 66 | "language": "pine", 67 | "path": "./snippets/ect.json" 68 | }, 69 | { 70 | "language": "pine", 71 | "path": "./snippets/f.json" 72 | }, 73 | { 74 | "language": "pine", 75 | "path": "./snippets/loopscounters.json" 76 | }, 77 | { 78 | "language": "pine", 79 | "path": "./snippets/principals.json" 80 | }, 81 | { 82 | "language": "pine", 83 | "path": "./snippets/scripts_add.json" 84 | }, 85 | { 86 | "language": "pine", 87 | "path": "./snippets/unicode.json" 88 | }, 89 | { 90 | "language": "pine", 91 | "path": "./snippets/words.json" 92 | } 93 | ], 94 | "languages": [ 95 | { 96 | "id": "pine", 97 | "aliases": [ 98 | "Pine Script", 99 | "PineScript", 100 | "Pine" 101 | ], 102 | "extensions": [ 103 | ".ps", 104 | ".pine", 105 | ".pinescript", 106 | ".pinecode", 107 | ".tdps", 108 | ".trading", 109 | ".tradingview", 110 | ".script", 111 | ".help" 112 | ], 113 | "configuration": "./language-configuration.json" 114 | } 115 | ], 116 | "grammars": [ 117 | { 118 | "language": "pine", 119 | "scopeName": "source.ps", 120 | "path": "./syntaxes/ps.tmLanguage.json" 121 | } 122 | ] 123 | }, 124 | "scripts": { 125 | "vscode:prepublish": "npm run package", 126 | "compile": "webpack", 127 | "watch": "webpack --watch", 128 | "package": "webpack --mode production --devtool hidden-source-map", 129 | "compile-tests": "tsc -p . --outDir out", 130 | "watch-tests": "tsc -p . -w --outDir out", 131 | "pretest": "npm run compile-tests && npm run compile && npm run lint", 132 | "lint": "eslint src --ext ts", 133 | "test": "node ./out/test/runTest.js" 134 | }, 135 | "devDependencies": { 136 | "@types/glob": "^7.1.4", 137 | "@types/mocha": "^9.0.0", 138 | "@types/node": "14.x", 139 | "@types/selenium-webdriver": "^4.0.16", 140 | "@types/vscode": "^1.62.0", 141 | "@typescript-eslint/eslint-plugin": "^5.1.0", 142 | "@typescript-eslint/parser": "^5.1.0", 143 | "@vscode/test-electron": "^1.6.2", 144 | "eslint": "^8.1.0", 145 | "glob": "^7.1.7", 146 | "mocha": "^9.1.3", 147 | "ts-loader": "^9.2.5", 148 | "typescript": "^4.4.4", 149 | "webpack": "^5.52.1", 150 | "webpack-cli": "^4.8.0" 151 | }, 152 | "repository": { 153 | "type": "git", 154 | "url": "https://github.com/jeyllani/pinescript.git" 155 | }, 156 | "dependencies": { 157 | "chromedriver": "^96.0.0", 158 | "selenium": "^2.20.0", 159 | "selenium-webdriver": "^4.1.0" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /snippets/built-in_language_operators.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "% ⇨ ⟗" : { 4 | "prefix" : "%", 5 | "body" : [ 6 | "% $0" 7 | ], 8 | "description" : "% | Language Operator" 9 | }, 10 | "%= ⇨ ⟗" : { 11 | "prefix" : "%=", 12 | "body" : [ 13 | "%= $0" 14 | ], 15 | "description" : "%= | Language Operator" 16 | }, 17 | "* ⇨ ⟗" : { 18 | "prefix" : "*", 19 | "body" : [ 20 | "* $0" 21 | ], 22 | "description" : "* | Language Operator" 23 | }, 24 | "*= ⇨ ⟗" : { 25 | "prefix" : "*=", 26 | "body" : [ 27 | "*= $0" 28 | ], 29 | "description" : "*= | Language Operator" 30 | }, 31 | "+ ⇨ ⟗" : { 32 | "prefix" : "+", 33 | "body" : [ 34 | "+ $0" 35 | ], 36 | "description" : "+ | Language Operator" 37 | }, 38 | "+= ⇨ ⟗" : { 39 | "prefix" : "+=", 40 | "body" : [ 41 | "+= $0" 42 | ], 43 | "description" : "+= | Language Operator" 44 | }, 45 | "- ⇨ ⟗" : { 46 | "prefix" : "-", 47 | "body" : [ 48 | "- $0" 49 | ], 50 | "description" : "- | Language Operator" 51 | }, 52 | "-= ⇨ ⟗" : { 53 | "prefix" : "-=", 54 | "body" : [ 55 | "-= $0" 56 | ], 57 | "description" : "-= | Language Operator" 58 | }, 59 | "/ ⇨ ⟗" : { 60 | "prefix" : "/", 61 | "body" : [ 62 | "/ $0" 63 | ], 64 | "description" : "/ | Language Operator" 65 | }, 66 | "/= ⇨ ⟗" : { 67 | "prefix" : "/=", 68 | "body" : [ 69 | "/= $0" 70 | ], 71 | "description" : "/= | Language Operator" 72 | }, 73 | "< ⇨ ⟗" : { 74 | "prefix" : "<", 75 | "body" : [ 76 | "< $0" 77 | ], 78 | "description" : "< | Language Operator" 79 | }, 80 | "<= ⇨ ⟗" : { 81 | "prefix" : "<=", 82 | "body" : [ 83 | "<= $0" 84 | ], 85 | "description" : "<= | Language Operator" 86 | }, 87 | "== ⇨ ⟗" : { 88 | "prefix" : "==", 89 | "body" : [ 90 | "== $0" 91 | ], 92 | "description" : "== | Language Operator" 93 | }, 94 | "=> ⇨ ⟗" : { 95 | "prefix" : "=>", 96 | "body" : [ 97 | "=> $0" 98 | ], 99 | "description" : "=> | Language Operator" 100 | }, 101 | "> ⇨ ⟗" : { 102 | "prefix" : ">", 103 | "body" : [ 104 | "> $0" 105 | ], 106 | "description" : "> | Language Operator" 107 | }, 108 | ">= ⇨ ⟗" : { 109 | "prefix" : ">=", 110 | "body" : [ 111 | ">= $0" 112 | ], 113 | "description" : ">= | Language Operator" 114 | }, 115 | "?: ⇨ ⟗" : { 116 | "prefix" : "?:", 117 | "body" : [ 118 | "$1 ? $2 : $3 $0" 119 | ], 120 | "description" : "?: | Language Operator" 121 | }, 122 | "[] ⇨ ⟗" : { 123 | "prefix" : "[", 124 | "body" : [ 125 | "[$0]" 126 | ], 127 | "description" : "[] | Language Operator" 128 | }, 129 | "and ⇨ ⟗" : { 130 | "prefix" : "and", 131 | "body" : [ 132 | "and$0" 133 | ], 134 | "description" : "and | Language Operator" 135 | }, 136 | "export ⇨ ⟗" : { 137 | "prefix" : "export", 138 | "body" : [ 139 | "export$0" 140 | ], 141 | "description" : "export | Language Operator" 142 | }, 143 | "for ⇨ ⟗" : { 144 | "prefix" : "for", 145 | "body" : [ 146 | "for$0" 147 | ], 148 | "description" : "for | Language Operator" 149 | }, 150 | "if ⇨ ⟗" : { 151 | "prefix" : "if", 152 | "body" : [ 153 | "if$0" 154 | ], 155 | "description" : "if | Language Operator" 156 | }, 157 | "import ⇨ ⟗" : { 158 | "prefix" : "import", 159 | "body" : [ 160 | "import$0" 161 | ], 162 | "description" : "import | Language Operator" 163 | }, 164 | "not ⇨ ⟗" : { 165 | "prefix" : "not", 166 | "body" : [ 167 | "not$0" 168 | ], 169 | "description" : "not | Language Operator" 170 | }, 171 | "or ⇨ ⟗" : { 172 | "prefix" : "or", 173 | "body" : [ 174 | "or$0" 175 | ], 176 | "description" : "or | Language Operator" 177 | }, 178 | "series ⇨ ⟗" : { 179 | "prefix" : "series", 180 | "body" : [ 181 | "series$0" 182 | ], 183 | "description" : "series | Language Operator" 184 | }, 185 | "simple ⇨ ⟗" : { 186 | "prefix" : "simple", 187 | "body" : [ 188 | "simple$0" 189 | ], 190 | "description" : "simple | Language Operator" 191 | }, 192 | "switch ⇨ ⟗" : { 193 | "prefix" : "switch", 194 | "body" : [ 195 | "switch$0" 196 | ], 197 | "description" : "switch | Language Operator" 198 | }, 199 | "var ⇨ ⟗" : { 200 | "prefix" : "var", 201 | "body" : [ 202 | "var$0" 203 | ], 204 | "description" : "var | Language Operator" 205 | }, 206 | "varip ⇨ ⟗" : { 207 | "prefix" : "varip", 208 | "body" : [ 209 | "varip$0" 210 | ], 211 | "description" : "varip | Language Operator" 212 | }, 213 | "while ⇨ ⟗" : { 214 | "prefix" : "while", 215 | "body" : [ 216 | "while$0" 217 | ], 218 | "description" : "while | Language Operator" 219 | } 220 | 221 | } 222 | 223 | -------------------------------------------------------------------------------- /snippets/built-in_scripts.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "ALMA ⇨ 𝑓𝑥": { 4 | "prefix": [ 5 | "s.alma", 6 | "script.arnaud.legoux.moving.average" 7 | ], 8 | "body": [ 9 | "// # ============================= ALMA Inputs =============================== #", 10 | "ALMA_Source = input.source( defval = close , title = \"Source\" , inline = \"00\", group = \"🌲 ALMA 🌲\")", 11 | "ALMA_WindowSize = input.int( defval = 9 , title = \"Window\" , inline = \"00\", group = \"🌲 ALMA 🌲\")", 12 | "ALMA_Offset = input.float( defval = 0.85 , title = \"Offset\" , inline = \"01\", group = \"🌲 ALMA 🌲\")", 13 | "ALMA_Sigma = input.float( defval = 6.00 , title = \"Sigma\" , inline = \"01\", group = \"🌲 ALMA 🌲\")", 14 | "// # ============================= ALMA Inputs =============================== #", 15 | "", 16 | "// # ========================== ALMA Calculation ============================= #", 17 | "ALMA = ta.alma(series = ALMA_Source, length = ALMA_WindowSize, offset = ALMA_Offset, sigma = ALMA_Sigma) ", 18 | "// # ========================== ALMA Calculation ============================= #", 19 | "", 20 | "${1:// # ============================ ALMA Plotting ============================== #", 21 | "plot(series = ALMA, title = \"ALMA\", color = color.new(color = color.blue, transp = 0))", 22 | "// # ============================ ALMA Plotting ============================== #}", 23 | "", 24 | "$0" 25 | ], 26 | "description": "Arnaud Legoux Moving Average | Built-in Script" 27 | }, 28 | 29 | "Aroon Script ⇨ 𝑓𝑥": { 30 | "prefix": ["s.aroon", "script.aroon"], 31 | "body": [ 32 | "// # ============================ Aroon Input =============================== #", 33 | "Aroon_length = input.int(defval = 14 , title = \"Length\", inline = \"01\", group = \"⚪ Aroon ⚪\")", 34 | "// # ============================ Aroon Input =============================== #", 35 | "", 36 | "// # ========================== Aroon Calculation ============================ #", 37 | "Aroon_upper = 100 * (ta.highestbars(high, Aroon_length + 1) + Aroon_length) / Aroon_length", 38 | "Aroon_lower = 100 * (ta.lowestbars(low, Aroon_length + 1) + Aroon_length) / Aroon_length", 39 | "// # ========================== Aroon Calculation ============================ #", 40 | "", 41 | "${1:// ============================= Plotting Aroon ============================== #", 42 | "plot(series = Aroon_upper, title = \"Aroon Up\" , color = color.new(color.orange, 0))", 43 | "plot(series = Aroon_lower, title = \"Aroon Down\" , color = color.new(color.blue, 0))", 44 | "// # =========================== Plotting Aroon ============================== #}", 45 | "${0}" 46 | ], 47 | "description": "Aroon Script | Built-in Script" 48 | }, 49 | 50 | "Auto Fibonnaci ⇨ 𝑓𝑥": { 51 | "prefix": ["s.autofib", "script.auto.fibonnaci"], 52 | "body": [ 53 | "${1:// ============================= Auto Fib Inputs ============================= #", 54 | "depthTooltip = \"The minimum number of bars that will be taken into account when calculating the indicator.\"", 55 | "depth = input.int( defval = 10 , title = \"Depth\" , minval = 1 , inline = \"Pivots\" , tooltip = depthTooltip , group = \"🎨 Auto Fibonnaci 🎨\")", 56 | "reverse = input.bool( defval = false , title = \"Reverse\" , inline = \"01\" , group = \"🎨 Auto Fibonnaci 🎨\")", 57 | "var extendLeft = input.bool( defval = false , title = \"Extend Left | Extend Right\" , inline = \"Extend Lines\" , group = \"🎨 Auto Fibonnaci 🎨\")", 58 | "var extendRight = input.bool( defval = true , title = \"\" , inline = \"Extend Lines\" , group = \"🎨 Auto Fibonnaci 🎨\")", 59 | "prices = input.bool( defval = true , title = \"Show Prices\" , inline = \"02\" , group = \"🎨 Auto Fibonnaci 🎨\")", 60 | "levels = input.bool( defval = true , title = \"Show Levels\" , inline=\"Levels\" , group = \"🎨 Auto Fibonnaci 🎨\")", 61 | "levelsFormat = input.string( defval = \"Values\" , title = \"\" , options = [\"Values\" , \"Percent\"] , inline =\"Levels\" , group = \"🎨 Auto Fibonnaci 🎨\")", 62 | "labelsPosition = input.string( defval = \"Left\" , title = \"Labels Position\" , options = [\"Left\" , \"Right\"] , inline = \"03\" , group = \"🎨 Auto Fibonnaci 🎨\")", 63 | "// # =========================== Auto Fib Inputs ============================= #", 64 | "", 65 | "// # ======================== Auto Fib Calculation =========================== #", 66 | "var extending = extend.none", 67 | "", 68 | "if extendLeft and extendRight", 69 | " extending := extend.both", 70 | " extending", 71 | "if extendLeft and not extendRight", 72 | " extending := extend.left", 73 | " extending", 74 | "if not extendLeft and extendRight", 75 | " extending := extend.right", 76 | " extending", 77 | "", 78 | "", 79 | "var float upperThreshold = 0.236", 80 | "var float lowerThreshold = 1.0", 81 | "", 82 | "var line lineLastHL = na", 83 | "var line lineLastLH = na", 84 | "var line lineLast = na", 85 | "", 86 | "var float iLastH = 0", 87 | "var float iLastL = 0", 88 | "var float pLastH = 0", 89 | "var float pLastL = 0", 90 | "", 91 | "var float[] iPivotsH = array.new_float()", 92 | "var float[] iPivotsL = array.new_float()", 93 | "var float[] pPivotsH = array.new_float()", 94 | "var float[] pPivotsL = array.new_float()", 95 | "", 96 | "var isHighLast = false", 97 | "var float startPrice = na", 98 | "var float endPrice = na", 99 | "var float diff = na", 100 | "", 101 | "pivots(src, length, isHigh) =>", 102 | " l2 = length * 2", 103 | " c = nz(src[length])", 104 | " ok = true", 105 | " for i = 0 to l2 by 1", 106 | " if isHigh and src[i] > c", 107 | " ok := false", 108 | " ok", 109 | "", 110 | " if not isHigh and src[i] < c", 111 | " ok := false", 112 | " ok", 113 | " if ok", 114 | " [bar_index[length], c]", 115 | " else", 116 | " [int(na), float(na)]", 117 | "[iH, pH] = pivots(high, depth / 2, true)", 118 | "[iL, pL] = pivots(low, depth / 2, false)", 119 | "", 120 | "countPivotsH = array.size(iPivotsH)", 121 | "countPivotsL = array.size(iPivotsL)", 122 | "", 123 | "if countPivotsH > 0 and countPivotsL > 0", 124 | " iLastH := array.get(iPivotsH, countPivotsH - 1)", 125 | " iLastL := array.get(iPivotsL, countPivotsL - 1)", 126 | " isHighLast := iLastH > iLastL", 127 | " iLastH := 1", 128 | " if isHighLast", 129 | " if not na(iH)", 130 | " pLastH := array.get(pPivotsH, countPivotsH - 1)", 131 | " if pH > pLastH", 132 | " array.set(iPivotsH, countPivotsH - 1, iH)", 133 | " array.set(pPivotsH, countPivotsH - 1, pH)", 134 | " iH := na", 135 | " iH", 136 | " else", 137 | " if not na(iL)", 138 | " pLastL := array.get(pPivotsL, countPivotsL - 1)", 139 | " if pL < pLastL", 140 | " array.set(iPivotsL, countPivotsL - 1, iL)", 141 | " array.set(pPivotsL, countPivotsL - 1, pL)", 142 | " iL := na", 143 | " iL", 144 | "", 145 | "if not na(iH)", 146 | " array.push(iPivotsH, iH)", 147 | " array.push(pPivotsH, pH)", 148 | "", 149 | "if not na(iL)", 150 | " array.push(iPivotsL, iL)", 151 | " array.push(pPivotsL, pL)", 152 | "", 153 | "pPivotsHCopy = array.copy(pPivotsH)", 154 | "pPivotsLCopy = array.copy(pPivotsL)", 155 | "iPivotsHCopy = array.copy(iPivotsH)", 156 | "iPivotsLCopy = array.copy(iPivotsL)", 157 | "", 158 | "if barstate.islast", 159 | " for j = bar_index to 0 by 1", 160 | " if array.size(iPivotsHCopy) == 0 or array.size(iPivotsLCopy) == 0", 161 | " break", 162 | "", 163 | " iLastH := array.pop(iPivotsHCopy)", 164 | " iLastL := array.pop(iPivotsLCopy)", 165 | "", 166 | " pLastH := array.pop(pPivotsHCopy)", 167 | " pLastL := array.pop(pPivotsLCopy)", 168 | "", 169 | " iPrevPivot = 0.0", 170 | " pPrevPivot = 0.0", 171 | "", 172 | " isHighLast := iLastH > iLastL", 173 | "", 174 | " if isHighLast", 175 | " for i = array.size(iPivotsHCopy) - 1 to 0 by 1", 176 | " if i < 0", 177 | " break", 178 | " else if array.get(iPivotsHCopy, i) < iLastL", 179 | " break", 180 | " if array.get(pPivotsHCopy, i) > pLastH", 181 | " iLastH := array.pop(iPivotsHCopy)", 182 | " pLastH := array.pop(pPivotsHCopy)", 183 | " pLastH", 184 | " else", 185 | " array.remove(iPivotsHCopy, i)", 186 | " array.remove(pPivotsHCopy, i)", 187 | " else", 188 | " for i = array.size(iPivotsLCopy) - 1 to 0 by 1", 189 | " if i < 0", 190 | " break", 191 | " else if array.get(iPivotsLCopy, i) < iLastH", 192 | " break", 193 | " if array.get(pPivotsLCopy, i) < pLastL", 194 | " iLastL := array.pop(iPivotsLCopy)", 195 | " pLastL := array.pop(pPivotsLCopy)", 196 | " pLastL", 197 | " else", 198 | " array.remove(iPivotsLCopy, i)", 199 | " array.remove(pPivotsLCopy, i)", 200 | "", 201 | " if array.size(iPivotsHCopy) == 0 or array.size(iPivotsLCopy) == 0", 202 | " break", 203 | "", 204 | " isHighLast := iLastH > iLastL", 205 | "", 206 | " if isHighLast", 207 | " iPrevPivot := array.get(iPivotsHCopy, array.size(iPivotsHCopy) - 1)", 208 | " pPrevPivot := array.get(pPivotsHCopy, array.size(iPivotsHCopy) - 1)", 209 | " pPrevPivot", 210 | " else", 211 | " iPrevPivot := array.get(iPivotsLCopy, array.size(iPivotsLCopy) - 1)", 212 | " pPrevPivot := array.get(pPivotsLCopy, array.size(iPivotsLCopy) - 1)", 213 | " pPrevPivot", 214 | "", 215 | " if isHighLast", 216 | " startPrice := pPrevPivot", 217 | " endPrice := pLastL", 218 | " diff := math.abs(startPrice - endPrice)", 219 | " if pLastH > endPrice + diff * lowerThreshold or pLastH < endPrice + diff * upperThreshold", 220 | " array.push(iPivotsLCopy, iLastL)", 221 | " array.push(pPivotsLCopy, pLastL)", 222 | " continue", 223 | " line.delete(lineLastHL)", 224 | " line.delete(lineLastLH)", 225 | " line.delete(lineLast)", 226 | " lineLastHL := line.new(int(iPrevPivot), pPrevPivot, int(iLastL), pLastL, color=color.red, width=1, style=line.style_dashed)", 227 | " lineLastLH := line.new(int(iLastL), pLastL, int(iLastH), pLastH, color=color.green, width=1, style=line.style_dashed)", 228 | " lineLast := lineLastLH", 229 | " lineLast", 230 | " else", 231 | " startPrice := pPrevPivot", 232 | " endPrice := pLastH", 233 | " diff := math.abs(startPrice - endPrice)", 234 | " if pLastL < endPrice - diff * lowerThreshold or pLastL > endPrice - diff * upperThreshold", 235 | " array.push(iPivotsHCopy, iLastH)", 236 | " array.push(pPivotsHCopy, pLastH)", 237 | " continue", 238 | " line.delete(lineLastHL)", 239 | " line.delete(lineLastLH)", 240 | " line.delete(lineLast)", 241 | " lineLastLH := line.new(int(iPrevPivot), pPrevPivot, int(iLastH), pLastH, color=color.red, width=1, style=line.style_dashed)", 242 | " lineLastHL := line.new(int(iLastH), pLastH, int(iLastL), pLastL, color=color.green, width=1, style=line.style_dashed)", 243 | " lineLast := lineLastHL", 244 | " lineLast", 245 | " break", 246 | "", 247 | "_draw_line(price, col) =>", 248 | " var id = line.new(0, price, 0, price, color=col, width=1, extend=extending)", 249 | " if not na(lineLast)", 250 | " line.set_xy1(id, line.get_x1(lineLast), price)", 251 | " line.set_xy2(id, line.get_x2(lineLast), price)", 252 | "", 253 | "_draw_label(price, txt, txtColor) =>", 254 | " if not na(price)", 255 | " x = labelsPosition == \"Left\" ? line.get_x1(lineLast) : not extendRight ? line.get_x2(lineLast) : bar_index", 256 | " labelStyle = labelsPosition == \"Left\" ? label.style_label_right : label.style_label_left", 257 | " align = labelsPosition == \"Left\" ? text.align_right : text.align_left", 258 | " labelsAlignStrLeft = txt + \"\\n ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ \\n\"", 259 | " labelsAlignStrRight = \" \" + txt + \"\\n ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ \\n\"", 260 | " labelsAlignStr = labelsPosition == \"Left\" ? labelsAlignStrLeft : labelsAlignStrRight", 261 | " var id = label.new(x=x, y=price, text=labelsAlignStr, textcolor=txtColor, style=labelStyle, textalign=align, color=#00000000)", 262 | " label.set_xy(id, x, price)", 263 | " label.set_text(id, labelsAlignStr)", 264 | " label.set_textcolor(id, txtColor)", 265 | "", 266 | "_wrap(txt) =>", 267 | " \"(\" + str.tostring(txt, \"#.##\") + \")\"", 268 | "", 269 | "_label_txt(level, price) =>", 270 | " if not na(price)", 271 | " l = levelsFormat == \"Values\" ? str.tostring(level) : str.tostring(level * 100) + \"%\"", 272 | " (levels ? l : \"\") + (prices ? _wrap(price) : \"\")", 273 | "", 274 | "_crossing_level(sr, r) =>", 275 | " r > sr and r < sr[1] or r < sr and r > sr[1]", 276 | "", 277 | "diff := (isHighLast ? -1 : 1) * math.abs(startPrice - endPrice)", 278 | "offset = isHighLast ? line.get_y1(lineLastLH) - line.get_y2(lineLastLH) : line.get_y1(lineLastHL) - line.get_y2(lineLastHL)", 279 | "offset := (isHighLast ? -1 : 1) * math.abs(offset)", 280 | "", 281 | "processLevel(show, value, colorL) =>", 282 | " float m = value", 283 | " r = endPrice - offset + (reverse ? -1 : 1) * diff * m", 284 | " if show", 285 | " _draw_line(r, colorL)", 286 | " _draw_label(r, _label_txt(m, r), colorL)", 287 | " if _crossing_level(close, r)", 288 | " alert(\"Autofib: \" + syminfo.ticker + \" crossing level \" + str.tostring(value))", 289 | "", 290 | "show_0 = input.bool(true, \"\", inline=\"Level0\")", 291 | "value_0 = input.int(0, \"\", inline=\"Level0\")", 292 | "color_0 = input.color(#787b86, \"\", inline=\"Level0\")", 293 | "processLevel(show_0, value_0, color_0)", 294 | "", 295 | "show_0_236 = input.bool(true, \"\", inline=\"Level0\")", 296 | "value_0_236 = input.float(0.236, \"\", inline=\"Level0\")", 297 | "color_0_236 = input.color(#f44336, \"\", inline=\"Level0\")", 298 | "processLevel(show_0_236, value_0_236, color_0_236)", 299 | "", 300 | "show_0_382 = input.bool(true, \"\", inline=\"Level1\")", 301 | "value_0_382 = input.float(0.382, \"\", inline=\"Level1\")", 302 | "color_0_382 = input.color(#81c784, \"\", inline=\"Level1\")", 303 | "processLevel(show_0_382, value_0_382, color_0_382)", 304 | "", 305 | "show_0_5 = input.bool(true, \"\", inline=\"Level1\")", 306 | "value_0_5 = input.float(0.5, \"\", inline=\"Level1\")", 307 | "color_0_5 = input.color(#4caf50, \"\", inline=\"Level1\")", 308 | "processLevel(show_0_5, value_0_5, color_0_5)", 309 | "", 310 | "show_0_618 = input.bool(true, \"\", inline=\"Level2\")", 311 | "value_0_618 = input.float(0.618, \"\", inline=\"Level2\")", 312 | "color_0_618 = input.color(#009688, \"\", inline=\"Level2\")", 313 | "processLevel(show_0_618, value_0_618, color_0_618)", 314 | "", 315 | "show_0_65 = input.bool(false, \"\", inline=\"Level2\")", 316 | "value_0_65 = input.float(0.65, \"\", inline=\"Level2\")", 317 | "color_0_65 = input.color(#009688, \"\", inline=\"Level2\")", 318 | "processLevel(show_0_65, value_0_65, color_0_65)", 319 | "", 320 | "show_0_786 = input.bool(true, \"\", inline=\"Level3\")", 321 | "value_0_786 = input.float(0.786, \"\", inline=\"Level3\")", 322 | "color_0_786 = input.color(#64b5f6, \"\", inline=\"Level3\")", 323 | "processLevel(show_0_786, value_0_786, color_0_786)", 324 | "", 325 | "show_1 = input.bool(true, \"\", inline=\"Level3\")", 326 | "value_1 = input.int(1, \"\", inline=\"Level3\")", 327 | "color_1 = input.color(#787b86, \"\", inline=\"Level3\")", 328 | "processLevel(show_1, value_1, color_1)", 329 | "", 330 | "show_1_272 = input.bool(false, \"\", inline=\"Level4\")", 331 | "value_1_272 = input.float(1.272, \"\", inline=\"Level4\")", 332 | "color_1_272 = input.color(#81c784, \"\", inline=\"Level4\")", 333 | "processLevel(show_1_272, value_1_272, color_1_272)", 334 | "", 335 | "show_1_414 = input.bool(false, \"\", inline=\"Level4\")", 336 | "value_1_414 = input.float(1.414, \"\", inline=\"Level4\")", 337 | "color_1_414 = input.color(#f44336, \"\", inline=\"Level4\")", 338 | "processLevel(show_1_414, value_1_414, color_1_414)", 339 | "", 340 | "show_1_618 = input.bool(true, \"\", inline=\"Level5\")", 341 | "value_1_618 = input.float(1.618, \"\", inline=\"Level5\")", 342 | "color_1_618 = input.color(#2196f3, \"\", inline=\"Level5\")", 343 | "processLevel(show_1_618, value_1_618, color_1_618)", 344 | "", 345 | "show_1_65 = input.bool(false, \"\", inline=\"Level5\")", 346 | "value_1_65 = input.float(1.65, \"\", inline=\"Level5\")", 347 | "color_1_65 = input.color(#2196f3, \"\", inline=\"Level5\")", 348 | "processLevel(show_1_65, value_1_65, color_1_65)", 349 | "", 350 | "show_2_618 = input.bool(true, \"\", inline=\"Level6\")", 351 | "value_2_618 = input.float(2.618, \"\", inline=\"Level6\")", 352 | "color_2_618 = input.color(#f44336, \"\", inline=\"Level6\")", 353 | "processLevel(show_2_618, value_2_618, color_2_618)", 354 | "", 355 | "show_2_65 = input.bool(false, \"\", inline=\"Level6\")", 356 | "value_2_65 = input.float(2.65, \"\", inline=\"Level6\")", 357 | "color_2_65 = input.color(#f44336, \"\", inline=\"Level6\")", 358 | "processLevel(show_2_65, value_2_65, color_2_65)", 359 | "", 360 | "show_3_618 = input.bool(true, \"\", inline=\"Level7\")", 361 | "value_3_618 = input.float(3.618, \"\", inline=\"Level7\")", 362 | "color_3_618 = input.color(#9c27b0, \"\", inline=\"Level7\")", 363 | "processLevel(show_3_618, value_3_618, color_3_618)", 364 | "", 365 | "show_3_65 = input.bool(false, \"\", inline=\"Level7\")", 366 | "value_3_65 = input.float(3.65, \"\", inline=\"Level7\")", 367 | "color_3_65 = input.color(#9c27b0, \"\", inline=\"Level7\")", 368 | "processLevel(show_3_65, value_3_65, color_3_65)", 369 | "", 370 | "show_4_236 = input.bool(true, \"\", inline=\"Level8\")", 371 | "value_4_236 = input.float(4.236, \"\", inline=\"Level8\")", 372 | "color_4_236 = input.color(#e91e63, \"\", inline=\"Level8\")", 373 | "processLevel(show_4_236, value_4_236, color_4_236)", 374 | "", 375 | "show_4_618 = input.bool(false, \"\", inline=\"Level8\")", 376 | "value_4_618 = input.float(4.618, \"\", inline=\"Level8\")", 377 | "color_4_618 = input.color(#81c784, \"\", inline=\"Level8\")", 378 | "processLevel(show_4_618, value_4_618, color_4_618)", 379 | "", 380 | "show_neg_0_236 = input.bool(false, \"\", inline=\"Level9\")", 381 | "value_neg_0_236 = input.float(-0.236, \"\", inline=\"Level9\")", 382 | "color_neg_0_236 = input.color(#f44336, \"\", inline=\"Level9\")", 383 | "processLevel(show_neg_0_236, value_neg_0_236, color_neg_0_236)", 384 | "", 385 | "show_neg_0_382 = input.bool(false, \"\", inline=\"Level9\")", 386 | "value_neg_0_382 = input.float(-0.382, \"\", inline=\"Level9\")", 387 | "color_neg_0_382 = input.color(#81c784, \"\", inline=\"Level9\")", 388 | "processLevel(show_neg_0_382, value_neg_0_382, color_neg_0_382)", 389 | "", 390 | "show_neg_0_618 = input.bool(false, \"\", inline=\"Level10\")", 391 | "value_neg_0_618 = input.float(-0.618, \"\", inline=\"Level10\")", 392 | "color_neg_0_618 = input.color(#009688, \"\", inline=\"Level10\")", 393 | "processLevel(show_neg_0_618, value_neg_0_618, color_neg_0_618)", 394 | "", 395 | "show_neg_0_65 = input.bool(false, \"\", inline=\"Level10\")", 396 | "value_neg_0_65 = input.float(-0.65, \"\", inline=\"Level10\")", 397 | "color_neg_0_65 = input.color(#009688, \"\", inline=\"Level10\")", 398 | "processLevel(show_neg_0_65, value_neg_0_65, color_neg_0_65)", 399 | "// # ======================== Auto Fib Calculation =========================== #}", 400 | "${0}" 401 | ], 402 | "description": "Auto Fibonnaci | Built-in Script" 403 | }, 404 | 405 | "Directional Movement Index ⇨ 𝑓𝑥": { 406 | "prefix": ["s.adx", "s.dmi", "script.directional.movement.index"], 407 | "body": [ 408 | "// # =================== Directional Moving Index Inputs ===================== #", 409 | "di_lenght = input.int(defval = 17, title = \"DI Length\", minval = 1, inline = \"01\", group = \"🟠 ADX 🟠\")", 410 | "sigma_length = input.int(defval = 14, title = \"ADX Smoothing\", minval = 1, maxval = 50, inline = \"02\", group = \"🟠 ADX 🟠\")", 411 | "// # =================== Directional Moving Index Inputs ===================== #", 412 | "", 413 | "// # ================ Directional Moving Index Calculation =================== #", 414 | "[DIplus, DIminus, ADX] = ta.dmi(di_lenght, sigma_length)", 415 | "// # ================ Directional Moving Index Calculation =================== #", 416 | "${1:", 417 | "// # ================== Directional Moving Index Plotting ==================== #", 418 | "plot(series = ADX, color = color.new(color.blue, 0), title = \"ADX\")", 419 | "plot(series = DIminus, color = color.new(color.red, 0), title = \"+DI\")", 420 | "plot(series = DIplus, color = color.new(color.lime, 0), title = \"-DI\")", 421 | "// # ================== Directional Moving Index Plotting ==================== #}", 422 | "${0}" 423 | ], 424 | "description": "Directional Movement Index | Built-in Script" 425 | }, 426 | 427 | "Average True Range ⇨ 𝑓𝑥": { 428 | "prefix": ["s.atr", "script.average.true.range"], 429 | "body": [ 430 | "// # ============================= ATR Inputs ================================ #", 431 | "ATR_length = input.int(defval = 14, title = \"Length\", minval = 1, group = \"🟤 ATR 🟤\")", 432 | "ATR_smoothing = input.string(defval = \"RMA\", title = \"Smoothing\", options = [\"RMA\", \"SMA\", \"EMA\", \"WMA\"], group = \"🟤 ATR 🟤\")", 433 | "// # ============================= ATR Inputs ================================ #", 434 | "", 435 | "// # ==================== ATR MA source option function ====================== #", 436 | "ma_function(source, ATR_length) =>", 437 | " if ATR_smoothing == \"RMA\"", 438 | " ta.rma(source, ATR_length)", 439 | " else", 440 | " if ATR_smoothing == \"SMA\"", 441 | " ta.sma(source, ATR_length)", 442 | " else", 443 | " if ATR_smoothing == \"EMA\"", 444 | " ta.ema(source, ATR_length)", 445 | " else", 446 | " ta.wma(source, ATR_length)", 447 | "// # ==================== ATR MA source option function ====================== #", 448 | "", 449 | "// # ============================ ATR (R|S|E)MA ============================== #", 450 | "ATR_RSEma = ma_function(ta.tr(true)", 451 | "// # ============================ ATR (R|S|E)MA ============================== # ", 452 | "", 453 | "${1:// ============================== ATR Plotting =============================== #", 454 | "plot(ATR_RSEma, title = \"ATR\", color = color.new(color.red, 0))", 455 | "// # ============================ ATR Plotting =============================== #}", 456 | "${0}" 457 | ], 458 | "description": "Average True Range | Built-in Script" 459 | }, 460 | 461 | "Awesome Oscillator ⇨ 𝑓𝑥": { 462 | "prefix": ["s.ao", "script.awesome.oscillator"], 463 | "body": [ 464 | "// # =================== Awesome Oscillator Calculation ====================== #", 465 | "Awesome_Oscillator = ta.sma(hl2, 5) - ta.sma(hl2, 34)", 466 | "// # =================== Awesome Oscillator Calculation ====================== #", 467 | "", 468 | "${1:// ======================= Awesome Oscillator Plotting ======================= #", 469 | "colorChanging = ta.change(Awesome_Oscillator) <= 0 ? #872323 : #007F0E", 470 | "", 471 | "plot(series = Awesome_Oscillator, color = color.new(colorChanging, 0) , style = plot.style_histogram)", 472 | "// # ===================== Awesome Oscillator Plotting ======================= #}", 473 | "${0}" 474 | ], 475 | "description": "Awesome Oscillator | Built-in Script" 476 | }, 477 | 478 | "Balance Power ⇨ 𝑓𝑥": { 479 | "prefix": ["s.balance.power", "script.balance.power"], 480 | "body": [ 481 | "// # ====================== Balance Power Calculation ======================== #", 482 | "Balance_Power = (close - open) / (high - low)", 483 | "// # ====================== Balance Power Calculation ======================== #", 484 | "", 485 | "${1:// ========================= Balance Power Plotting ========================== #", 486 | "plot(series = Balance_Power, color = color.new(color.red, 0))", 487 | "// # ======================= Balance Power Plotting ========================== #}", 488 | "${0}" 489 | ], 490 | "description": "Balance Power | Built-in Script" 491 | }, 492 | 493 | "Bollinger Bands ⇨ 𝑓𝑥": { 494 | "prefix": ["s.bb", "script.bollinger.bands"], 495 | "body": [ 496 | "// # ============================== BB Inputs ================================ #", 497 | "BB_source = input.source( defval = close, title = \"Source\", inline = \"00\", group = \"🔵 Bollinger Bands 🔵\")", 498 | "BB_length = input.int( defval = 20, title = \"Length\", minval = 1, inline = \"01\", group = \"🔵 Bollinger Bands 🔵\")", 499 | "BB_Multiplicator = input.float( defval = 2.0, title = \"STD\", minval = 0.001, maxval = 50, inline = \"01\", group = \"🔵 Bollinger Bands 🔵\")", 500 | "BB_offset = input.int( defval = 0, title =\"Offset\", minval = -500, maxval = 500, inline = \"01\", group = \"🔵 Bollinger Bands 🔵\")", 501 | "// # ============================== BB Inputs ================================ #", 502 | "", 503 | "// # =========================== BB Calculation ============================== #", 504 | "BB_basis = ta.sma(source = BB_source, length = BB_length)", 505 | "BB_std = BB_Multiplicator * ta.stdev(source = BB_source, length = BB_length)", 506 | "BB_upper = BB_basis + BB_std", 507 | "BB_lower = BB_basis - BB_std", 508 | "// # =========================== BB Calculation ============================== #", 509 | "", 510 | "${1:// =============================== BB Plotting =============================== #", 511 | "plot(series = BB_basis, title = \"Basis\", color = color.new(#FF6D00, 0), offset = BB_offset)", 512 | "p1 = plot(series = BB_upper, title = \"Upper\", color = color.new(#2962FF, 0), offset = BB_offset)", 513 | "p2 = plot(series = BB_lower, title = \"Lower\", color = color.new(#2962FF, 0), offset = BB_offset)", 514 | "fill(plot1 = p1, plot2 = p2, title = \"Background\", color = color.rgb(33, 150, 243, 95))", 515 | "// # ============================= BB Plotting =============================== #}", 516 | "${0}" 517 | ], 518 | "description": "Bollinger Bands | Built-in Script" 519 | }, 520 | 521 | "Chaikin Money Flow ⇨ 𝑓𝑥": { 522 | "prefix": ["s.cmf", "script.chaikin.money.flow"], 523 | "body": [ 524 | "// # ====================== Chaikin Money Flow Input ========================= #", 525 | "CMF_length = input.int(defval = 20, title = \"Lenght\", minval = 1, inline = \"00\", group = \"🟣 Chaikin Money Flow 🟣\")", 526 | "// # ====================== Chaikin Money Flow Input ========================= #", 527 | "", 528 | "// # =================== Chaikin Money Flow Calculation ====================== #", 529 | "var Cumulative_Volume = 0.", 530 | "Cumulative_Volume += nz(source = volume)", 531 | "", 532 | "if barstate.islast and Cumulative_Volume == 0", 533 | " runtime.error(message = \"No volume is provided by the data vendor\")", 534 | "", 535 | "CMF_ad = close == high and close == low or high == low ? 0 : ((2*close-low-high)/(high-low))*volume", 536 | "Moneyflow = math.sum(source = CMF_ad, length = CMF_length) / math.sum(source = volume, length = CMF_length)", 537 | "// # =================== Chaikin Money Flow Calculation ====================== #", 538 | "", 539 | "${1:// ======================= Chaikin Money Flow Plotting ======================= #", 540 | "plot(series = Moneyflow, title = \"MF\", color = color.new(color #43A047, transp = 0))", 541 | "hline(price = 0, title = \"Zero\", color = color.new(color #787B86, transp = 0), linestyle = hline.style_dashed)", 542 | "// # ===================== Chaikin Money Flow Plotting ======================= #}", 543 | "${0}" 544 | ], 545 | "description": "Chaikin Money Flow | Built-in Script" 546 | }, 547 | 548 | "Chaikin Oscillator ⇨ 𝑓𝑥": { 549 | "prefix": ["s.co", "script.chaikin.oscillator"], 550 | "body": [ 551 | "// # ====================== Chaikin Oscillator Inputs ======================== #", 552 | "co_short = input.int(defval = 3 , title = \"Fast Length\" , minval = 1 , inline = \"01\" , group = \"🟪 Chaikin Oscillator 🟪\")", 553 | "co_long = input.int(defval = 10 , title = \"Slow Length\" , minval = 1 , inline = \"02\" , group = \"🟪 Chaikin Oscillator 🟪\")", 554 | "// # ====================== Chaikin Oscillator Inputs ======================== #", 555 | "", 556 | "// # =================== Chaikin Oscillator Calculation ====================== #", 557 | "var cumVol = 0.00", 558 | "cumVol += nz(volume)", 559 | "", 560 | "if barstate.islast and cumVol == 0", 561 | " runtime.error(\"No volume is provided by the data vendor.\")", 562 | "", 563 | "co_osc = ta.ema(source = ta.accdist, length = co_short) - ta.ema(source = ta.accdist, length = co_long)", 564 | "// # =================== Chaikin Oscillator Calculation ====================== #", 565 | "", 566 | "${1:// # ===================== Chaikin Oscillator Plotting ======================= #", 567 | "plot(series = co_osc , title = \"Chaikin Oscillator\", color = color.new(color = #EC407A, transp = 0))", 568 | "hline(price = 0 , title = \"Zero\" , color = color.new(color = #787B86, transp = 0), linestyle = hline.style_dashed)", 569 | "// # ===================== Chaikin Oscillator Plotting ======================= #}", 570 | "$0" 571 | ], 572 | "description": "Chaikin Oscillator ⇨ 𝑓𝑥" 573 | }, 574 | 575 | "Chande Kroll Stop ⇨ 𝑓𝑥": { 576 | "prefix": ["s.cks", "script.chande.kroll.stop"], 577 | "body": [ 578 | "// # ====================== Chande Kroll Stop Inputs ========================= #", 579 | "p_cks = input.int(defval = 10 , minval = 1 , title = \"High Stop Length\" , inline = \"01\" , group = \"🟧 Chande Kroll Stop 🟧\")", 580 | "x_cks = input.int(defval = 1 , minval = 1 , title = \"Low Stop Length\" , inline = \"02\" , group = \"🟧 Chande Kroll Stop 🟧\")", 581 | "q_cks = input.int(defval = 9 , minval = 1 , title = \"Short Stop Length\" , inline = \"03\" , group = \"🟧 Chande Kroll Stop 🟧\")", 582 | "// # ====================== Chande Kroll Stop Inputs ========================= #", 583 | "", 584 | "// # ==================== Chande Kroll Stop Calculation ====================== #", 585 | "first_high_stop = ta.highest( source = high , length = p_cks) - x_cks * ta.atr(length = p_cks)", 586 | "first_low_stop = ta.lowest( source = low , length = p_cks) + x_cks * ta.atr(length = p_cks)", 587 | "stop_short = ta.highest( source = first_high_stop , length = q_cks)", 588 | "stop_long = ta.lowest( source = first_low_stop , length = q_cks)", 589 | "// # ==================== Chande Kroll Stop Calculation ====================== #", 590 | "", 591 | "${1:// # ===================== Chande Kroll Stop Plotting ======================== #", 592 | "plot(series = stop_long , color = color.new(color = #2962FF, transp = 0))", 593 | "plot(series = stop_short , color = color.new(color = #FF6D00, transp = 0))", 594 | "// # ===================== Chande Kroll Stop Plotting ======================== #}", 595 | "$0" 596 | ], 597 | "description": "Chand Kroll Stop | Built-in Script" 598 | }, 599 | 600 | "Chande Momentum Oscillator ⇨ 𝑓𝑥": { 601 | "prefix": ["s.cmo", "script.chandler.momentum.oscillator"], 602 | "body": [ 603 | "// # ============================= CMO Inputs ================================ #", 604 | "cmo_length = input.int( defval = 9 , minval = 1 , title = \"Length\" , inline = \"01\" , group = \"🟨 Chande Momentum Oscillator 🟨\")", 605 | "cmo_src = input.source( defval = close , title = \"Source\" , inline = \"01\" , group = \"🟨 Chande Momentum Oscillator 🟨\")", 606 | "// # ============================= CMO Inputs ================================ #", 607 | "", 608 | "// # =========================== CMO Calculation ============================= #", 609 | "momm = ta.change(cmo_src)", 610 | "f1(m) => m >= 0.0 ? m : 0.0", 611 | "f2(m) => m >= 0.0 ? 0.0 : -m", 612 | "m1 = f1(momm)", 613 | "m2 = f2(momm)", 614 | "", 615 | "sm1 = math.sum(m1, cmo_length)", 616 | "sm2 = math.sum(m2, cmo_length)", 617 | "percent(nom, div) => 100 * nom / div", 618 | "chandeMO = percent(sm1-sm2, sm1+sm2)", 619 | "// # =========================== CMO Calculation ============================= #", 620 | "", 621 | "${1:// # ============================ CMO Plotting =============================== #", 622 | "plot(series = chandeMO , title = \"Chande MO\" , color = color.new(color = #2962FF , transp = 0))", 623 | "hline(price = 0 , title=\"Zero Line\" , color = color.new(color = #787B86 , transp = 0) , linestyle = hline.style_dashed)", 624 | "// # ============================ CMO Plotting =============================== #}", 625 | "$0" 626 | ], 627 | "description": "Chande Momentum Oscillator ⇨ 𝑓𝑥" 628 | }, 629 | 630 | "Chop Zone ⇨ 𝑓𝑥": { 631 | "prefix": ["s.cz", "script.chop.zone"], 632 | "body": [ 633 | "${1://@version=5", 634 | "//indicator(title = \"Chop Zone\", format=format.price, precision=0, timeframe=\"\", timeframe_gaps=true)}", 635 | "// # ========================== Chop Zone sources ============================ #", 636 | "cz_source = close", 637 | "cz_avg = hlc3", 638 | "// # ========================== Chop Zone sources ============================ #", 639 | "", 640 | "// # ======================== Chop Zone Calculation ========================== #", 641 | "pi_rad = math.atan(1) * 4", 642 | "cz_periods = 30", 643 | "cz_highestHigh = ta.highest(length = cz_periods)", 644 | "cz_lowestLow = ta.lowest(length = cz_periods)", 645 | "span = 25 / (cz_highestHigh - cz_lowestLow) * cz_lowestLow", 646 | "ema34 = ta.ema(source = cz_source, length = 34)", 647 | "x1_ema34 = 0", 648 | "x2_ema34 = 1", 649 | "y1_ema34 = 0", 650 | "y2_ema34 = (ema34[1] - ema34) / cz_avg * span", 651 | "c_ema34 = math.sqrt((number = (x2_ema34 - x1_ema34) * (x2_ema34 - x1_ema34) + (y2_ema34 - y1_ema34) * (y2_ema34 - y1_ema34)))", 652 | "emaAngle_1 = math.round(number = (180 * math.acos((x2_ema34 - x1_ema34) / c_ema34) / pi_rad))", 653 | "emaAngle = y2_ema34 > 0? - emaAngle_1: emaAngle_1", 654 | "// # ======================== Chop Zone Calculation ========================== #", 655 | "", 656 | "${2:// ============================ Chop Zone Colors ============================= #", 657 | "colorTurquoise #26C6DA", 658 | "colorDarkGreen #43A047", 659 | "colorPaleGreen #A5D6A7", 660 | "colorLime #009688", 661 | "colorDarkRed #D50000", 662 | "colorRed #E91E63", 663 | "colorOrange #FF6D00", 664 | "colorLightOrange #FFB74D", 665 | "colorYellow #FDD835", 666 | "cz_color = emaAngle >= 5 ", 667 | " ? colorTurquoise : emaAngle < 5 and emaAngle >= 3.57", 668 | " ? colorDarkGreen : emaAngle < 3.57 and emaAngle >= 2.14", 669 | " ? colorPaleGreen : emaAngle < 2.14 and emaAngle >= .71", 670 | " ? colorLime : emaAngle <= -1 * 5", 671 | " ? colorDarkRed : emaAngle > -1 * 5 and emaAngle <= -1 * 3.57", 672 | " ? colorRed : emaAngle > -1 * 3.57 and emaAngle <= -1 * 2.14", 673 | " ? colorOrange : emaAngle > -1 * 2.14 and emaAngle <= -1 * .71", 674 | " ? colorLightOrange : colorYellow", 675 | "// # ========================== Chop Zone Colors ============================= #", 676 | "", 677 | "// # ========================= Chop Zone Plotting ============================ #", 678 | "plot(series = 1, color = color.new(color = cz_color, transp = 0), style = plot.style_columns)", 679 | "// # ========================= Chop Zone Plotting ============================ #}", 680 | "${0}" 681 | ], 682 | "description": "Chop Zone | Built-in Script" 683 | }, 684 | 685 | "Choppiness Index ⇨ 𝑓𝑥": { 686 | "prefix": ["s.chopindex", "script.choppiness.index"], 687 | "body": [ 688 | "// # ======================= Choppiness Index Input ========================== #", 689 | "chin_length = input.int(defval = 14 , title = \"length\" , minval = 1 , inline = \"01\", group = \"🟫 Choppiness Index 🟫\")", 690 | "chin_offset = input.int(defval = 0 , title = \"Offset\" , minval = -500 , maxval = 500 , inline = \"01\", group = \"🟫 Choppiness Index 🟫\")", 691 | "// # ======================= Choppiness Index Input ========================== #", 692 | "", 693 | "// # ==================== Choppiness Index Calculation ======================= #", 694 | "chin = 100 * math.log10(number = math.sum(source = ta.atr(length = 1), length = chin_length) /", 695 | " (ta.highest(length = chin_length) - ta.lowest(length = chin_length))) /", 696 | " math.log10(number = chin_length)", 697 | "// # ==================== Choppiness Index Calculation ======================= #", 698 | "", 699 | "${1:// # ====================== Choppiness Index Plotting ======================== #", 700 | "plot( series = chin , title = \"CHOP\" , color = color.new(#2962FF, transp = 0) , offset = chin_offset)", 701 | "ch_band1 = hline(price = 61.8 , title = \"Upper Band\" , color = color.new(#787B86, transp = 0) , linestyle = hline.style_dashed)", 702 | "ch_band0 = hline(price = 38.2 , title = \"Lower Band\" , color = color.new(#787B86, transp = 0) , linestyle = hline.style_dashed)", 703 | "fill (hline1 = ch_band1 , hline2 = ch_band0 , color = color.rgb(33, 150, 243, 90) , title = \"Background\")", 704 | "// # ====================== Choppiness Index Plotting ======================== #}", 705 | "$0" 706 | ], 707 | "description": "Choppiness Index ⇨ 𝑓𝑥" 708 | }, 709 | 710 | "Commodity Channel Index ⇨ 𝑓𝑥": { 711 | "prefix": ["s.cci", "script.commodity.channel.index"], 712 | "body": [ 713 | "// # =================== Commodity Channel Index Inputs ====================== #", 714 | "cci_length = input.int( defval = 20 , title = \"lengt\" , minval = 1 , inline = \"01\", group = \"🟪 CCI 🟪\")", 715 | "cci_src = input( defval = hlc3 , title = \"Source\" , inline = \"01\", group = \"🟪 CCI 🟪\")", 716 | "// # =================== Commodity Channel Index Inputs ====================== #", 717 | "", 718 | "// # ================= Commodity Channel Index Calculation =================== #", 719 | "cci_ma = ta.sma(source = cci_src, length = cci_length)", 720 | "cci = (cci_src - cci_ma) / (0.015 * ta.dev(source = cci_src, length = cci_length))", 721 | "// # ================= Commodity Channel Index Calculation =================== #", 722 | "", 723 | "${1:// # ================== Commodity Channel Index Plotting ===================== #", 724 | "plot( series = cci , title = \"CCI\" , color = color.new(color = #2962FF , transp = 0))", 725 | "cci_b1 = hline( 100 , title = \"Upper Band\" , color = color.new(color = #787B86 , transp = 0), linestyle = hline.style_dashed)", 726 | "cci_b0 = hline(-100 , title = \"Lower Band\" , color = color.new(color = #787B86 , transp = 0), linestyle = hline.style_dashed)", 727 | "fill( hline1 = cci_b1 , hline2 = cci_b0 , color = color.rgb(33, 150, 243, 90) , title = \"Background\")", 728 | "// # ================== Commodity Channel Index Plotting ===================== #}", 729 | "$0" 730 | ], 731 | "description": "Commodity Channel Index ⇨ 𝑓𝑥" 732 | } 733 | 734 | 735 | 736 | } 737 | -------------------------------------------------------------------------------- /snippets/comments.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "Comment Line ⇨ //": { 4 | "prefix": ["//", "ln", "comment.line_1"], 5 | "body": [ 6 | "// # ========================================================================= #", 7 | "" 8 | ], 9 | "description": "Comment Line" 10 | }, 11 | 12 | "Comment Line 2 ⇨ //": { 13 | "prefix": ["//", "lnn", "comment.line_2"], 14 | "body": [ 15 | "// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", 16 | "" 17 | ], 18 | "description": "Comment Line" 19 | }, 20 | 21 | "Comment | Line ⇨ //": { 22 | "prefix": ["//", "comment.line_2"], 23 | "body": [ 24 | "// --${1/./*/g}- ${1} -${1/./*/g}-- //", 25 | "", 26 | "${0}" 27 | ], 28 | "description": "Type & Tab" 29 | }, 30 | 31 | "Comment box ⇨ //": { 32 | "prefix": ["//", "bx", "comment.box_1"], 33 | "body": [ 34 | "// # ========================================================================= #", 35 | "// # ${1}", 36 | "// # ========================================================================= #", 37 | "${0}" 38 | ], 39 | "description": "Comment box" 40 | }, 41 | 42 | "Comment big box ⇨ //": { 43 | "prefix": ["bxx", "comment.big.box_1"], 44 | "body": [ 45 | "// # ========================================================================= #", 46 | "// # ========================================================================= #", 47 | "// # ${1}", 48 | "// # ========================================================================= #", 49 | "// # ========================================================================= #", 50 | "${0}" 51 | ], 52 | "description": "comment big box" 53 | }, 54 | 55 | "Comment | BOX ⇨ //": { 56 | "prefix": ["//", "bx2", "comment.box_2"], 57 | "body": [ 58 | "// --${1/./*/g}-- //", 59 | "// - ${1} - //", 60 | "// --${1/./*/g}-- //", 61 | "${0}", 62 | "" 63 | ], 64 | "description": "Type & Tab" 65 | }, 66 | 67 | "Comment | Big BOX | Empty ⇨ //": { 68 | "prefix": ["//", "bxx2", "comment.big.box_2"], 69 | "body": [ 70 | "// --${1/./*/g}-- //", 71 | "// ${1/./ /g} //", 72 | "// ${1/./ /g} //", 73 | "// - ${1} - //", 74 | "// ${1/./ /g} //", 75 | "// ${1/./ /g} //", 76 | "// --${1/./*/g}-- //", 77 | "", 78 | "${0}" 79 | ], 80 | "description": "Type & Tab" 81 | }, 82 | 83 | "Comment | Big BOX | Full ⇨ //": { 84 | "prefix": ["//", "comment.big.box_3"], 85 | "body": [ 86 | "//***${1/./*/g}*****", 87 | "//***${1/./*/g}*****", 88 | "//*-[ ${1} ]-*", 89 | "//***${1/./*/g}*****", 90 | "//***${1/./*/g}*****", 91 | "", 92 | "${0}" 93 | ], 94 | "description": "Type & Tab" 95 | }, 96 | 97 | "Info Box List ⇨ //": { 98 | "prefix": ["//", "bxlist", "comment.box.list"], 99 | "body": [ 100 | "// # ========================================================================= #", 101 | "// * > ${1}${2:", 102 | "// * > ${3}}${4:", 103 | "// * > ${5}}${6:", 104 | "// * > ${7}}${8:", 105 | "// * > ${9}}${10:", 106 | "// * > ${11}}${12:", 107 | "// * > ${13}}${14:", 108 | "// * > ${15}}", 109 | "// # ========================================================================= #", 110 | "${0}" 111 | ], 112 | "description": "Info Box List" 113 | }, 114 | 115 | "Info Box List {1,10} ⇨ //": { 116 | "prefix": ["//", "bxlistn", "comment.box.list_num"], 117 | "body": [ 118 | "// # ========================================================================= #", 119 | "// * >* ${1} *<${2:", 120 | "// * > 1. ${3}}${4:", 121 | "// * > 2. ${5}}${6:", 122 | "// * > 3. ${7}}${8:", 123 | "// * > 4. ${9}}${10:", 124 | "// * > 5. ${11}}${12:", 125 | "// * > 6. ${13}}${14:", 126 | "// * > 7. ${15}}${16:", 127 | "// * > 8. ${17}}${18:", 128 | "// * > 9. ${19}}${20:", 129 | "// * > 10. ${21}}", 130 | "// # ========================================================================= #", 131 | "${0}" 132 | ], 133 | "description": "Info Box List 1-10" 134 | }, 135 | 136 | "Info Box XXL ⇨ //": { 137 | "prefix": ["//", "bxxx", "comment.box.big3"], 138 | "body": [ 139 | "// # ========================================================================= #", 140 | "// #", 141 | "// # > ${1}", 142 | "// #", 143 | "// #", 144 | "// #", 145 | "// #", 146 | "// #", 147 | "// #", 148 | "// # ========================================================================= #", 149 | "${0}" 150 | ], 151 | "description": "Info Box XXL" 152 | }, 153 | 154 | "// @description ⇨ //": { 155 | "prefix": ["//", "// @description"], 156 | "body": [ 157 | "// @description $1", 158 | "$0" 159 | ], 160 | "description": "Library | description" 161 | }, 162 | 163 | "// @param ⇨ //": { 164 | "prefix": ["//", "// @param"], 165 | "body": [ 166 | "// @param $1", 167 | "$0" 168 | ], 169 | "description": "Library | param" 170 | }, 171 | 172 | "// @function ⇨ //": { 173 | "prefix": ["//", "// @function"], 174 | "body": [ 175 | "// @function $1", 176 | "$0" 177 | ], 178 | "description": "Library | function" 179 | }, 180 | 181 | "// @returns ⇨ //": { 182 | "prefix": ["//", "// @returns"], 183 | "body": [ 184 | "// @returns $1", 185 | "$0" 186 | ], 187 | "description": "Library | returns" 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /snippets/ect.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | 4 | "License | username": { 5 | "prefix": "headers", 6 | "body": [ 7 | "// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/", 8 | "// © ${1:username}", 9 | "//@version=5", 10 | "", 11 | "$0" 12 | ], 13 | "description": "License | username" 14 | }, 15 | 16 | "New Variable": { 17 | "prefix": "vn", 18 | "body": [ 19 | "${1/ /_/g} ${1/.//gi} = $0" 20 | ], 21 | "description": "New Variable" 22 | }, 23 | 24 | "Current Date & Time 🧭": { 25 | "prefix": ["info.date", "comment.date", "/"], 26 | "body": [ 27 | "// #-----------------------#", 28 | "// # ${CURRENT_YEAR_SHORT}-${CURRENT_MONTH}-${CURRENT_DATE} | ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND} #", 29 | "// #-----------------------#", 30 | "$0" 31 | ], 32 | "description": "Current Date & Time" 33 | }, 34 | 35 | "Current Date & Time 2 🧭": { 36 | "prefix": ["info.date2", "comment.date2", "/"], 37 | "body": [ 38 | "// #-------------------------#", 39 | "// # ${CURRENT_YEAR} ${CURRENT_MONTH_NAME_SHORT} ${CURRENT_DAY_NAME_SHORT} | ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND} #", 40 | "// #-------------------------#", 41 | "$0" 42 | ], 43 | "description": "Current Date & Time 2" 44 | }, 45 | 46 | "Current Date & Time 3 🧭": { 47 | "prefix": ["info.date3", "comment.date3", "/"], 48 | "body": [ 49 | "// #-----------------------------------#", 50 | "// # ${CURRENT_YEAR} ${CURRENT_MONTH_NAME} ${CURRENT_DAY_NAME} | ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND} #", 51 | "// #-----------------------------------#", 52 | "$0" 53 | ], 54 | "description": "Current Date & Time 3" 55 | }, 56 | 57 | "Actual number of seconds since UNIX epoch 🧭": { 58 | "prefix": "info.unix", 59 | "body": [ 60 | "// #--------------#", 61 | "// # ${CURRENT_SECONDS_UNIX} #", 62 | "// #--------------#", 63 | "$0" 64 | ], 65 | "description": "Actual number of seconds since UNIX epoch" 66 | }, 67 | 68 | "Pine Script V5 Manual 🌲": { 69 | "prefix": ["help", "info.pinescript"], 70 | "body": [ 71 | "// ====================================================================================================#", 72 | "// ## https://www.tradingview.com/pine-script-reference/v5/ | > Pine Script V5 Reference Manual #", 73 | "// ----------------------------------------------------------------------------------------------------#", 74 | "// ## https://www.tradingview.com/pine-script-docs/en/v5/ | > Pine Script V5 Docs #", 75 | "// ====================================================================================================#", 76 | "$0" 77 | ], 78 | "description": "Pine Script V5 Manual | Docs" 79 | }, 80 | 81 | "Info Time Zones 🧭": { 82 | "prefix": "info.timezone", 83 | "body": [ 84 | "// ====================================================================================================#", 85 | "// ## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | > IANA Time Zone #", 86 | "// ----------------------------------------------------------------------------------------------------#", 87 | "// ## https://en.wikipedia.org/wiki/List_of_time_zones_by_country | > Time Zones by Country #", 88 | "// ----------------------------------------------------------------------------------------------------#", 89 | "// ## https://www.unixtimestamp.com/index.php | > Unix Time Converter #", 90 | "// ----------------------------------------------------------------------------------------------------#", 91 | "// ## https://www.tradingview.com/pine-script-reference/v5/#fun_timestamp | > Pine Script Manual #", 92 | "// ====================================================================================================#", 93 | "", 94 | "$0" 95 | ], 96 | "description": "Info Time Zones | URL's" 97 | }, 98 | 99 | "operator = ⇨ ⟗" : { 100 | "prefix": ["operator", "op"], 101 | "body": [ 102 | "${1| ,%,%=,*,*=,+,+=,-,-=,/,/=,<,<=,==,=>,>,>=,and,export,for,if,import,not,or,series,simple,switch,var,varip,while|}" 103 | ], 104 | "description" : "$ | Language Operators List" 105 | }, 106 | 107 | "Built-in variable ⇨ 𝑥" : { 108 | "prefix": ["variable"], 109 | "body": [ 110 | "${1| ,adjustment.dividends,adjustment.none,adjustment.splits,alert.freq_all,alert.freq_once_per_bar,alert.freq_once_per_bar_close,bar_index,barmerge.gaps_off,barmerge.gaps_on,barmerge.lookahead_off,barmerge.lookahead_on,barstate.isconfirmed,barstate.isfirst,barstate.ishistory,barstate.islast,barstate.islastconfirmedhistory,barstate.isnew,barstate.isrealtime,box.all,close,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow,currency.AUD,currency.CAD,currency.CHF,currency.EUR,currency.GBP,currency.HKD,currency.JPY,currency.NOK,currency.NONE,currency.NZD,currency.RUB,currency.SEK,currency.SGD,currency.TRY,currency.USD,currency.ZAR,dayofmonth,dayofweek,dayofweek.friday,dayofweek.monday,dayofweek.saturday,dayofweek.sunday,dayofweek.thursday,dayofweek.tuesday,dayofweek.wednesday,display.all,display.none,dividends.gross,dividends.net,earnings.actual,earnings.estimate,earnings.standardized,extend.both,extend.left,extend.none,extend.right,format.inherit,format.mintick,format.percent,format.price,format.volume,high,hl2,hlc3,hline.style_dashed,hline.style_dotted,hline.style_solid,hour,label.all,label.style_arrowdown,label.style_arrowup,label.style_circle,label.style_cross,label.style_diamond,label.style_flag,label.style_label_center,label.style_label_down,label.style_label_left,label.style_label_lower_left,label.style_label_lower_right,label.style_label_right,label.style_label_up,label.style_label_upper_left,label.style_label_upper_right,label.style_none,label.style_square,label.style_triangledown,label.style_triangleup,label.style_xcross,line.all,line.style_arrow_both,line.style_arrow_left,line.style_arrow_right,line.style_dashed,line.style_dotted,line.style_solid,location.abovebar,location.absolute,location.belowbar,location.bottom,location.top,low,math.e,math.phi,math.pi,math.rphi,minute,month,na,ohlc4,open,order.ascending,order.descending,plot.style_area,plot.style_areabr,plot.style_circles,plot.style_columns,plot.style_cross,plot.style_histogram,plot.style_line,plot.style_linebr,plot.style_stepline,plot.style_stepline_diamond,position.bottom_center,position.bottom_left,position.bottom_right,position.middle_center,position.middle_left,position.middle_right,position.top_center,position.top_left,position.top_right,scale.left,scale.none,scale.right,second,session.extended,session.ismarket,session.ispostmarket,session.ispremarket,session.regular,shape.arrowdown,shape.arrowup,shape.circle,shape.cross,shape.diamond,shape.flag,shape.labeldown,shape.labelup,shape.square,shape.triangledown,shape.triangleup,shape.xcross,size.auto,size.huge,size.large,size.normal,size.small,size.tiny,splits.denominator,splits.numerator,strategy.account_currency,strategy.cash,strategy.closedtrades,strategy.commission.cash_per_contract,strategy.commission.cash_per_order,strategy.commission.percent,strategy.direction.all,strategy.direction.long,strategy.direction.short,strategy.equity,strategy.eventrades,strategy.fixed,strategy.grossloss,strategy.grossprofit,strategy.initial_capital,strategy.long,strategy.losstrades,strategy.max_contracts_held_all,strategy.max_contracts_held_long,strategy.max_contracts_held_short,strategy.max_drawdown,strategy.netprofit,strategy.oca.cancel,strategy.oca.none,strategy.oca.reduce,strategy.openprofit,strategy.opentrades,strategy.percent_of_equity,strategy.position_avg_price,strategy.position_entry_name,strategy.position_size,strategy.short,strategy.wintrades,syminfo.basecurrency,syminfo.currency,syminfo.description,syminfo.mintick,syminfo.pointvalue,syminfo.prefix,syminfo.root,syminfo.session,syminfo.ticker,syminfo.tickerid,syminfo.timezone,syminfo.type,ta.accdist,ta.iii,ta.nvi,ta.obv,ta.pvi,ta.pvt,ta.tr,ta.vwap,ta.wad,ta.wvad,table.all,text.align_bottom,text.align_center,text.align_left,text.align_right,text.align_top,time,time_close,time_tradingday,timeframe.isdaily,timeframe.isdwm,timeframe.isintraday,timeframe.isminutes,timeframe.ismonthly,timeframe.isseconds,timeframe.isweekly,timeframe.multiplier,timeframe.period,timenow,volume,weekofyear,xloc.bar_index,xloc.bar_time,year,yloc.abovebar,yloc.belowbar,yloc.price|}" 111 | ], 112 | "description" : "$ | Built-in Variables List" 113 | }, 114 | 115 | "Built-in function ⇨ 𝑓" : { 116 | "prefix": ["function"], 117 | "body": [ 118 | "${1| ,alert(),alertcondition(),array.avg(),array.clear(),array.concat(),array.copy(),array.covariance(),array.fill(),array.from(),array.get(),array.includes(),array.indexof(),array.insert(),array.join(),array.lastindexof(),array.max(),array.median(),array.min(),array.mode(),array.new_bool(),array.new_box(),array.new_color(),array.new_float(),array.new_int(),array.new_label(),array.new_line(),array.new_string(),array.new_table(),array.pop(),array.push(),array.range(),array.remove(),array.reverse(),array.set(),array.shift(),array.size(),array.slice(),array.sort(),array.standardize(),array.stdev(),array.sum(),array.unshift(),array.variance(),barcolor(),bgcolor(),bool(),box(),box.delete(),box.get_bottom(),box.get_left(),box.get_right(),box.get_top(),box.new(),box.set_bgcolor(),box.set_border_color(),box.set_border_style(),box.set_border_width(),box.set_bottom(),box.set_extend(),box.set_left(),box.set_lefttop(),box.set_right(),box.set_rightbottom(),box.set_top(),color(),color.b(),color.from_gradient(),color.g(),color.new(),color.r(),color.rgb(),color.t(),dayofmonth(),dayofweek(),fill(),fixnan(),float(),hline(),hour(),indicator(),input(),input.bool(),input.color(),input.float(),input.int(),input.price(),input.session(),input.source(),input.string(),input.symbol(),input.time(),input.timeframe(),int(),label(),label.delete(),label.get_text(),label.get_x(),label.get_y(),label.new(),label.set_color(),label.set_size(),label.set_style(),label.set_text(),label.set_textalign(),label.set_textcolor(),label.set_tooltip(),label.set_x(),label.set_xloc(),label.set_xy(),label.set_y(),label.set_yloc(),library(),line(),line.delete(),line.get_price(),line.get_x1(),line.get_x2(),line.get_y1(),line.get_y2(),line.new(),line.set_color(),line.set_extend(),line.set_style(),line.set_width(),line.set_x1(),line.set_x2(),line.set_xloc(),line.set_xy1(),line.set_xy2(),line.set_y1(),line.set_y2(),math.abs(),math.acos(),math.asin(),math.atan(),math.avg(),math.ceil(),math.cos(),math.exp(),math.floor(),math.log(),math.log10(),math.max(),math.min(),math.pow(),math.random(),math.round(),math.round_to_mintick(),math.sign(),math.sin(),math.sqrt(),math.sum(),math.tan(),math.todegrees(),math.toradians(),max_bars_back(),minute(),month(),na(),nz(),plot(),plotarrow(),plotbar(),plotcandle(),plotchar(),plotshape(),request.dividends(),request.earnings(),request.financial(),request.quandl(),request.security(),request.splits(),runtime.error(),second(),str.format(),str.length(),str.replace_all(),str.split(),str.tonumber(),str.tostring(),strategy(),strategy.cancel(),strategy.cancel_all(),strategy.close(),strategy.close_all(),strategy.closedtrades.commission(),strategy.closedtrades.entry_bar_index(),strategy.closedtrades.entry_price(),strategy.closedtrades.entry_time(),strategy.closedtrades.exit_bar_index(),strategy.closedtrades.exit_price(),strategy.closedtrades.exit_time(),strategy.closedtrades.max_drawdown(),strategy.closedtrades.max_runup(),strategy.closedtrades.profit(),strategy.closedtrades.size(),strategy.convert_to_account(),strategy.convert_to_symbol(),strategy.entry(),strategy.exit(),strategy.opentrades.commission(),strategy.opentrades.entry_bar_index(),strategy.opentrades.entry_price(),strategy.opentrades.entry_time(),strategy.opentrades.max_drawdown(),strategy.opentrades.max_runup(),strategy.opentrades.profit(),strategy.opentrades.size(),strategy.order(),strategy.risk.allow_entry_in(),strategy.risk.max_cons_loss_days(),strategy.risk.max_drawdown(),strategy.risk.max_intraday_filled_orders(),strategy.risk.max_intraday_loss(),strategy.risk.max_position_size(),string(),ta.alma(),ta.atr(),ta.barssince(),ta.bb(),ta.bbw(),ta.cci(),ta.change(),ta.cmo(),ta.cog(),ta.correlation(),ta.cross(),ta.crossover(),ta.crossunder(),ta.cum(),ta.dev(),ta.dmi(),ta.ema(),ta.falling(),ta.highest(),ta.highestbars(),ta.hma(),ta.kc(),ta.kcw(),ta.linreg(),ta.lowest(),ta.lowestbars(),ta.macd(),ta.median(),ta.mfi(),ta.mode(),ta.mom(),ta.percentile_linear_interpolation(),ta.percentile_nearest_rank(),ta.percentrank(),ta.pivothigh(),ta.pivotlow(),ta.range(),ta.rising(),ta.rma(),ta.roc(),ta.rsi(),ta.sar(),ta.sma(),ta.stdev(),ta.stoch(),ta.supertrend(),ta.swma(),ta.tr(),ta.tsi(),ta.valuewhen(),ta.variance(),ta.vwap(),ta.vwma(),ta.wma(),ta.wpr(),table(),table.cell(),table.cell_set_bgcolor(),table.cell_set_height(),table.cell_set_text(),table.cell_set_text_color(),table.cell_set_text_halign(),table.cell_set_text_size(),table.cell_set_text_valign(),table.cell_set_width(),table.clear(),table.delete(),table.new(),table.set_bgcolor(),table.set_border_color(),table.set_border_width(),table.set_frame_color(),table.set_frame_width(),table.set_position(),ticker.heikinashi(),ticker.kagi(),ticker.linebreak(),ticker.modify(),ticker.new(),ticker.pointfigure(),ticker.renko(),time(),time_close(),timestamp(),weekofyear(),year()|}" 119 | ], 120 | "description" : "$ | Built-in Functions List" 121 | } 122 | 123 | 124 | } -------------------------------------------------------------------------------- /snippets/f.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "Array Content to Label ⇨ Ⓕ": { 4 | "prefix": "f.array.label", 5 | "body": [ 6 | "// # ========================= Array Content Label =========================== #", 7 | "var A = ${1:// Insert your Array}", 8 | "lab = \"\"", 9 | "", 10 | "for i = 0 to array.size(A) - 1", 11 | " lab := lab + str.tostring(array.get(A, i)) + \" \"", 12 | "", 13 | "arrayLabel = label.new(x = bar_index, y = close, text = lab, color = color.new(color = color.white transp = 15), textcolor = color.new(color = color.black, transp = 0), size = size.normal, textalign = text.align_right)", 14 | "label.delete(l[1])", 15 | "// # ========================= Array Content Label =========================== #", 16 | "", 17 | "$0" 18 | ], 19 | "description": "Array Content to Label" 20 | }, 21 | 22 | "Gradient Function ⇨ Ⓕ": { 23 | "prefix": "f.gradient", 24 | "body": [ 25 | "// # ========================================================================= #", 26 | "// # Gradient Function #", 27 | "// # ========================================================================= #", 28 | "", 29 | "dataGradient = ${1:MyDataVariable} // Series of data to be plotted // ", 30 | "", 31 | "f_gradient(_c_col, _transp) =>", 32 | "", 33 | " _c_red = color.r(_c_col)", 34 | " _c_green = color.g(_c_col)", 35 | " _c_blue = color.b(_c_col)", 36 | "", 37 | " color.rgb(_c_red, _c_green, _c_blue, _transp)", 38 | "", 39 | "gradientData = color.from_gradient(dataGradient, ${2| ,\"Bottom Level Value\",-100,-75,-50,-25,0,10,20,25,30,40,50,60,70,75,80,90,100|}, ${3| ,\"Top Level Value\",-100,-75,-50,-25,0,10,20,25,30,40,50,60,70,75,80,90,100|}, ${4| ,🎨 \"Bottom Level Color\" 🎨,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow|}, ${5| ,🎨 \"Top Level Color\" 🎨,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow|})", 40 | "", 41 | "plot(series = dataGradient, ${6:title = \"$1 Gradient\",} color = f_gradient(gradientData, ${7|Transparency,10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 100|})${8:, ${9:${10:linewidth = ${11| ,1,2,3,4|},} ${12:style = ${13| ,plot.style_area,plot.style_areabr,plot.style_circles,plot.style_columns,plot.style_cross,plot.style_histogram,plot.style_line,plot.style_linebr,plot.style_stepline|},} ${14:trackprice = ${15| ,false,true|},} ${16:histbase = ${17| ,0.00, 0.50, 1.00, 2.00, 5.00, 7.00, 10.00, 25.00, 50.00, 75.00, 100.00|},} ${18:offset = ${19| ,0,1,2,3,4,5,6,7,8,9,10,20,25,30,35,40,50|},} ${20:join = ${21| ,false,true|},} ${22:editable = ${23| ,false,true|},} ${24:show_last = ${25| ,0,1,2,3,4,5,6,7,8,9,10,20,25,30,35,40,50|},} ${26:display = ${27| ,true,false|}}}})", 42 | "", 43 | "// # ========================================================================= #", 44 | "// # Gradient Function #", 45 | "// # ========================================================================= #", 46 | "", 47 | "${0}" 48 | ], 49 | "description": "Gradient" 50 | }, 51 | 52 | "Security Function ⇨ Ⓕ": { 53 | "prefix": "f.security", 54 | "body": [ 55 | "// # ========================== Security Function ============================ #", 56 | "", 57 | "f_security(_symbol, _tf, _src) =>", 58 | " request.security(symbol = _symbol, timeframe = _tf, expression = _src${1|[barstate.isrealtime ? 1 : 0],[0]|}${2:${3:, gaps = ${4| ,barmerge.gaps_off,barmerge.gaps_on|}}${5:, lookahead = ${6| ,barmerge.lookahead_off,barmerge.lookahead_on|}}})", 59 | "", 60 | "// # ========================== Security Function ============================ #", 61 | "", 62 | "${0}" 63 | ], 64 | "description": "Security Function" 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /snippets/loopscounters.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | 4 | "for i = | by | if | elsif | else": { 5 | "prefix": "forif", 6 | "body": [ 7 | "for i = ${1} to ${2} ${3:by = ${4}}", 8 | " ${5:if ${6}", 9 | " ${7}", 10 | " ${8:${9:else if ${10}", 11 | " ${11}", 12 | " }else ", 13 | " ${12}}}", 14 | "${0}", 15 | "" 16 | ], 17 | "description": "for i = | by | if | elsif | else" 18 | }, 19 | 20 | "for i = | by | continue | break": { 21 | "prefix": "fori", 22 | "body": [ 23 | "${1} = for i = ${2} to ${3} ${4:by = ${5}}", 24 | " ${6} ${7|:=,=,==,+=,*=,%=,//=,-=,*,/,+,-|} ${8}", 25 | " ${9:${10:${11:continue}", 26 | " ${12}", 27 | " }${13:break", 28 | " ${14}}}", 29 | "${0}" 30 | ], 31 | "description": "for i = | by | continue | break" 32 | }, 33 | 34 | "for counter = from_num to to_num [by step_num]": { 35 | "prefix": "for", 36 | "body": [ 37 | "for i = ${1} to ${2} ${3:by = ${4}}", 38 | " ${0}" 39 | ], 40 | "description": "for counter = from_num to to_num [by step_num]" 41 | }, 42 | 43 | "if | else | if | else": { 44 | "prefix": "if", 45 | "body": [ 46 | "if ${1}", 47 | " ${2}", 48 | "${3:${4:${5:else if ${6}", 49 | " ${7}", 50 | "}else ", 51 | " ${8}}}", 52 | "${0}" 53 | ], 54 | "description": "if | else if | else" 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /snippets/principals.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "{b} indicator ⇨ 𝑓": { 4 | "prefix": ["indicator.block", "indicator"], 5 | "body": [ 6 | "// # ========================================================================= #", 7 | "// # | $1 Indicator |", 8 | "// # ========================================================================= #", 9 | "indicator(", 10 | " title = \"${3}\"${4:,", 11 | " shorttitle = \"${5}\"}${6:,", 12 | " overlay = ${7| ,true,false|}}${8:,", 13 | " format = ${9| ,format.inherit,format.price,format.volume,format.value|}}${10:,", 14 | " precision = ${11| ,1,2,3,4,5|}}${12:,", 15 | " scale = ${13| ,scale.right,scale.left,scale.none|}}${14:,", 16 | " timeframe = \"${15| ,m,H,D,W,M,Y,15,30,45,60,90,120,180,240,480|}\"}${16:,", 17 | " timeframe_gaps = ${17| ,true,false|}}${18:,", 18 | " explicit_plot_zorder = ${19| ,false,true|}}${20:,", 19 | " max_lines_count = ${21| ,5,10,50,100,200,300,500|}}${22:,", 20 | " max_labels_count = ${23| ,5,10,50,100,200,300,500|}}${24:,", 21 | " max_boxes_count = ${25| ,5,10,50,100,200,300,500|}}", 22 | " )", 23 | "// # ========================================================================= #", 24 | "// # | $1 Indicator |", 25 | "// # ========================================================================= #", 26 | "", 27 | "$0" 28 | ], 29 | "description": "indicator(title, shorttitle, overlay, format, precision, scale, max_bars_back, timeframe, timeframe_gaps, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count) → void" 30 | }, 31 | 32 | "Indicator ⇨ 𝑓": { 33 | "prefix": "indicator", 34 | "body": [ 35 | "// # ========================================================================= #", 36 | "// # | $1 Indicator |", 37 | "// # ========================================================================= #", 38 | "indicator(title = \"${1}\"${2:, shorttitle = \"${3}\"}${4:, overlay = ${5| ,true,false|}}${6:, format = ${7| ,format.inherit,format.price,format.volume,format.value|}}${8:, precision = ${9| ,1,2,3,4,5|}}${10:, scale = ${11| ,scale.right,scale.left,scale.none|}}${12:, timeframe = \"${13| ,m,H,D,W,M,Y,15,30,45,60,90,120,180,240,480|}\"}${14:, timeframe_gaps = ${15| ,true,false|}}${16:, explicit_plot_zorder = ${17| ,false,true|}}${18:, max_lines_count = ${19| ,5,10,50,100,200,300,500|}}${20:, max_labels_count = ${21| ,5,10,50,100,200,300,500|}}${22:, max_boxes_count = ${23| ,5,10,50,100,200,300,500|}})", 39 | "// # ========================================================================= #", 40 | "// # | $1 Indicator |", 41 | "// # ========================================================================= #", 42 | "", 43 | "$0" 44 | ], 45 | "description": "indicator(title, shorttitle, overlay, format, precision, scale, max_bars_back, timeframe, timeframe_gaps, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count) → void" 46 | }, 47 | 48 | "{username} {b} indicator ⇨ 𝑓": { 49 | "prefix": "indicator.new", 50 | "body": [ 51 | "// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/", 52 | "// © ${1:username}", 53 | "", 54 | "//@version=5", 55 | "", 56 | "// # ========================================================================= #", 57 | "// # | $1 Indicator |", 58 | "// # ========================================================================= #", 59 | "indicator(", 60 | " title = \"${2}\"${3:,", 61 | " shorttitle = \"${4}\"}${5:,", 62 | " overlay = ${6| ,true,false|}}${7:,", 63 | " format = ${8| ,format.inherit,format.price,format.volume,format.value|}}${9:,", 64 | " precision = ${10| ,1,2,3,4,5|}}${11:,", 65 | " scale = ${12| ,scale.right,scale.left,scale.none|}}${13:,", 66 | " timeframe = \"${14| ,m,H,D,W,M,Y,15,30,45,60,90,120,180,240,480|}\"}${15:,", 67 | " timeframe_gaps = ${16| ,true,false|}}${17:,", 68 | " explicit_plot_zorder = ${18| ,false,true|}}${19:,", 69 | " max_lines_count = ${20| ,5,10,50,100,200,300,500|}}${21:,", 70 | " max_labels_count = ${22| ,5,10,50,100,200,300,500|}}${23:,", 71 | " max_boxes_count = ${24| ,5,10,50,100,200,300,500|}}", 72 | " )", 73 | "// # ========================================================================= #", 74 | "// # | $1 Indicator |", 75 | "// # ========================================================================= #", 76 | "", 77 | "$0" 78 | ], 79 | "description": "indicator(title, shorttitle, overlay, format, precision, scale, max_bars_back, timeframe, timeframe_gaps, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count) → void" 80 | }, 81 | 82 | "New Library ⇨ 𝑓": { 83 | "prefix": ["library.new", "library"], 84 | "body": [ 85 | "//@version=5", 86 | "", 87 | "// @description ${1:}", 88 | "", 89 | "library(title = \"${2/ /_/g}\", overlay = ${3| ,true,false|})", 90 | "", 91 | "", 92 | "export ${4:function_name}(${5:} = ${6:[]}${7:${8:[...]}}) =>", 93 | " ${9:}", 94 | "", 95 | "// ===========================================================================*", 96 | "// * >* The $4 Function *<", 97 | "// *==========================================================================*", 98 | "// @function ${10:}", 99 | "// @param ${11: }", 100 | "// @returns ${12:}${13:", 101 | "// *==========================================================================*", 102 | "// * > 1. ${14:+info}${15:", 103 | "// * > 2. ${16:+info}}${17:", 104 | "// * > 3. ${18:+info}}${19:", 105 | "// * > 4. ${20:+info}}${21:", 106 | "// * > 5. ${22:+info}}}", 107 | "// *==========================================================================*", 108 | "$0" 109 | ], 110 | "description": "library(title = string, overlay = bool) → void" 111 | }, 112 | 113 | "{b} Strategy ⇨ 𝑓": { 114 | "prefix": ["strategy.block", "strategy"], 115 | "body": [ 116 | "// # ========================================================================= #", 117 | "// # | $1 STRATEGY |", 118 | "// # ========================================================================= #", 119 | "strategy(", 120 | " title = \"${1}\"${2:,", 121 | " shorttitle = \"${3}\"}${4:,", 122 | " overlay = ${5| ,true,false|}}${6:,", 123 | " format = ${7| ,format.inherit,format.price,format.value|}}${8:, ", 124 | " precision = ${9| ,1,2,3,4,5|}}${10:, ", 125 | " scale = ${11| ,scale.right,scale.left,scale.none|}}${12:, ", 126 | " pyramiding = ${13| ,0,1,2,3,4,5,6,7,8,9,10|}}${14:, ", 127 | " calc_on_order_fills = ${15| ,true,false|}}${16:, ", 128 | " calc_on_every_tick = ${17| ,true,false|}}${18:, ", 129 | " max_bars_back = ${19| ,1,2,3,4,5,6,7,8|}}${20:, ", 130 | " backtest_fill_limits_assumption = ${21| ,true,false|}}${22:, ", 131 | " default_qty_type = ${23| ,strategy.fixed,strategy.cash,strategy.percent_of_equity|}}${24:, ", 132 | " default_qty_value = ${25| ,5,10,15,20,25,30,35,40,50,60,75,80,90,100|}}${26:, ", 133 | " initial_capital = ${27| ,100,1000,10000,100000|}}${28:, ", 134 | " currency = ${29| ,currency.NONE,currency.USD,currency.EUR,currency.AUD,currency.GBP,currency.NZD,currency.CAD,currency.CHF,currency.HKD,currency.JPY,currency.NOK,currency.SEK,currency.SGD,currency.TRY,currency.ZAR|}}${30:, ", 135 | " slippage = ${31| ,1,2,3,4,5|}}${32:, ", 136 | " commission_type = ${33| ,strategy.commission.percent,strategy.commission.cash_per_contract,strategy.commission.cash_per_order|}}${34:, ", 137 | " commission_value = ${35| ,0.01,0.02,0.03,0.04|}}${36:, ", 138 | " process_orders_on_close = ${37| ,true,false|}}${38:, ", 139 | " close_entries_rule = ${39| ,'FIFO','ANY'|}}${40:, ", 140 | " margin_long = ${41| ,5,10,15|}}${42:, ", 141 | " margin_short = ${43| ,5,10,15|}}${44:, ", 142 | " explicit_plot_zorder = ${45| ,true,false|}}${46:, ", 143 | " max_lines_count = ${47| ,5,10,50,100,200,300,500|}}${48:, ", 144 | " max_labels_count = ${49| ,5,10,50,100,200,300,500|}}${50:, ", 145 | " max_boxes_count = ${51| ,5,10,50,100,200,300,500|}}", 146 | " )", 147 | "// # ========================================================================= #", 148 | "// # | $1 STRATEGY |", 149 | "// # ========================================================================= #", 150 | "", 151 | "$0" 152 | ], 153 | "description": "strategy(title, shorttitle, overlay, format, precision, scale, pyramiding, calc_on_order_fills, calc_on_every_tick, max_bars_back, backtest_fill_limits_assumption, default_qty_type, default_qty_value, initial_capital, currency, slippage, commission_type, commission_value, process_orders_on_close, close_entries_rule, margin_long, margin_short, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count) → void" 154 | }, 155 | 156 | "Strategy ⇨ 𝑓": { 157 | "prefix": "strategy", 158 | "body": [ 159 | "// # ========================================================================= #", 160 | "// # | $1 STRATEGY |", 161 | "// # ========================================================================= #", 162 | "strategy(title = \"${1}\"${2:, shorttitle = \"${3}\"}${4:, overlay = ${5| ,true,false|}}${6:, format = ${7| ,format.inherit,format.price,format.value|}}${8:, precision = ${9| ,1,2,3,4,5|}}${10:, scale = ${11| ,scale.right,scale.left,scale.none|}}${12:, pyramiding = ${13| ,0,1,2,3,4,5,6,7,8,9,10|}}${14:, calc_on_order_fills = ${15| ,true,false|}}${16:, calc_on_every_tick = ${17| ,true,false|}}${18:, max_bars_back = ${19| ,1,2,3,4,5,6,7,8|}}${20:, backtest_fill_limits_assumptio = ${21| ,true,false|}}${22:, default_qty_type = ${23| ,strategy.fixed,strategy.cash,strategy.percent_of_equity|}}${24:, default_qty_value = ${25| ,5,10,15,20,25,30,35,40,50,60,75,80,90,100|}}${26:, initial_capital = ${27| ,100,1000,10000,100000|}}${28:, currency = ${29| ,currency.NONE,currency.USD,currency.EUR,currency.AUD,currency.GBP,currency.NZD,currency.CAD,currency.CHF,currency.HKD,currency.JPY,currency.NOK,currency.SEK,currency.SGD,currency.TRY,currency.ZAR|}}${30:, slippage = ${31| ,1,2,3,4,5|}}${32:, commission_type = ${33| ,strategy.commission.percent,strategy.commission.cash_per_contract,strategy.commission.cash_per_order|}}${34:, commission_value = ${35| ,0.01,0.02,0.03,0.04|}}${36:, process_orders_on_close = ${37| ,true,false|}}${38:, close_entries_rule = ${39| ,'FIFO','ANY'|}}${40:, margin_long = ${41| ,5,10,15|}}${42:, margin_short = ${43| ,5,10,15|}}${44:, explicit_plot_zorder = ${45| ,true,false|}}${46:, max_lines_count = ${47| ,5,10,50,100,200,300,500|}}${48:, max_labels_count = ${49| ,5,10,50,100,200,300,500|}}${50:, max_boxes_count = ${51| ,5,10,50,100,200,300,500|}})", 163 | "// # ========================================================================= #", 164 | "// # | $1 STRATEGY |", 165 | "// # ========================================================================= #", 166 | "$0" 167 | ], 168 | "description": "strategy(title, shorttitle, overlay, format, precision, scale, pyramiding, calc_on_order_fills, calc_on_every_tick, max_bars_back, backtest_fill_limits_assumption, default_qty_type, default_qty_value, initial_capital, currency, slippage, commission_type, commission_value, process_orders_on_close, close_entries_rule, margin_long, margin_short, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count) → void" 169 | } 170 | 171 | } 172 | 173 | -------------------------------------------------------------------------------- /snippets/scripts_add.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "Backtesting start/end ⇨ 𝑓𝑥": { 4 | "prefix": "f.backtesting", 5 | "body": [ 6 | "// # ========================= Backtesting Inputs ============================ #", 7 | "Start_date = input.int(defval = 1 , title = \"Day ➡\" , minval = 1 , maxval = 31 , inline = \"00\" , group = \"⏱ Backtesting Start ⏱\")", 8 | "Start_month = input.int(defval = 1 , title = \"Month ➡\" , minval = 1 , maxval = 12 , inline = \"00\" , group = \"⏱ Backtesting Start ⏱\")", 9 | "Start_year = input.int(defval = 2000 , title = \"Year ➡\" , minval = 2000 , maxval = 2100 , inline = \"00\" , group = \"⏱ Backtesting Start ⏱\")", 10 | "", 11 | "End_date = input.int(defval = 1 , title = \"Day ➡\" , minval = 1 , maxval = 31 , inline = \"01\" , group = \"⏱ Backtesting End ⏱\")", 12 | "End_month = input.int(defval = 1 , title = \"Month ➡\" , minval = 1 , maxval = 12 , inline = \"01\" , group = \"⏱ Backtesting End ⏱\")", 13 | "End_year = input.int(defval = 2030 , title = \"Year ➡\" , minval = 2000 , maxval = 2100 , inline = \"01\" , group = \"⏱ Backtesting End ⏱\")", 14 | "// # ========================= Backtesting Inputs ============================ #", 15 | "", 16 | "// # ======================= Backtesting Calculation ========================= #", 17 | "backtesting = (time >= timestamp(syminfo.timezone, Start_year, Start_month, Start_date, 0, 0)) and (time <= timestamp(syminfo.timezone, End_year, End_month, End_date, 0, 0))", 18 | "// # ======================= Backtesting Calculation ========================= #", 19 | "", 20 | "$0", 21 | "" 22 | ], 23 | "description": "Backtesting start/end" 24 | }, 25 | 26 | "Bollinger Bands different MA's ⇨ 𝑓𝑥": { 27 | "prefix": "f.bb", 28 | "body": [ 29 | "// # ============================== BB Inputs ================================ #", 30 | "BB_source = input.source( defval = close , title = \"Source\" , inline = \"00\" , group = \"🔵 Bollinger Bands 🔵\")", 31 | "BB_MA = input.string( defval = \"SMA\" , title = \"MA Source\" , options = [\"RMA\" , \"SMA\" , \"EMA\" , \"WMA\"] , inline = \"00\" , group = \"🔵 Bollinger Bands 🔵\")", 32 | "BB_length = input.int( defval = 20 , title = \"Length\" , minval = 1 , inline = \"01\" , group = \"🔵 Bollinger Bands 🔵\")", 33 | "BB_Multiplicator = input.float( defval = 2.0 , title = \"STD\" , minval = 0.001 , maxval = 50 , inline = \"01\" , group = \"🔵 Bollinger Bands 🔵\")", 34 | "BB_offset = input.int( defval = 0 , title = \"Offset\" , minval = -500 , maxval = 500 , inline = \"01\" , group = \"🔵 Bollinger Bands 🔵\")", 35 | "// # ============================== BB Inputs ================================ #", 36 | "", 37 | "// # =========================== BB Calculation ============================== #", 38 | "bb_ma_function(source, length) =>", 39 | " if BB_MA == \"RMA\"", 40 | " ta.rma(source, length)", 41 | " else", 42 | " if BB_MA == \"SMA\"", 43 | " ta.sma(source, length)", 44 | " else", 45 | " if BB_MA == \"EMA\"", 46 | " ta.ema(source, length)", 47 | " else", 48 | " ta.wma(source, length)", 49 | "", 50 | "BB_basis = bb_ma_function(BB_source, BB_length)", 51 | "BB_std = BB_Multiplicator * ta.stdev(source = BB_source, length = BB_length)", 52 | "BB_upper = BB_basis + BB_std", 53 | "BB_lower = BB_basis - BB_std", 54 | "// # =========================== BB Calculation ============================== #", 55 | "", 56 | "${1:// # ============================= BB Plotting =============================== #", 57 | "plot(series = BB_basis, title = \"Basis\", color = color.new(#FF6D00, 0), offset = BB_offset)", 58 | "p1 = plot(series = BB_upper, title = \"Upper\", color = color.new(#2962FF, 0), offset = BB_offset)", 59 | "p2 = plot(series = BB_lower, title = \"Lower\", color = color.new(#2962FF, 0), offset = BB_offset)", 60 | "fill(plot1 = p1, plot2 = p2, title = \"Background\", color = color.rgb(33, 150, 243, 95))", 61 | "// # ============================= BB Plotting =============================== #}" 62 | ], 63 | "description": "Bollinger Bands different MA's" 64 | }, 65 | 66 | "Trailing SL & TP ⇨ 𝑓𝑥": { 67 | "prefix": "f.stoploss", 68 | "body": [ 69 | "", 70 | "// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒* STOP LOSS *▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", 71 | "// # ======================== percent2point inputs =========================== #", 72 | "percent2points(percent) => strategy.position_avg_price * percent / 100 / syminfo.mintick", 73 | "", 74 | "ActivateStopLoss = input.bool( defval = true , title = \"Activate Stoploss\" , inline = \"00\" , group = \"⛔ SL & TP ⛔\")", 75 | "sl_input = input.int( defval = 5 , title = \"SL %\" , inline = \"01\" , group = \"⛔ SL & TP ⛔\")", 76 | "tp1_input = input.int( defval = 5 , title = \"TP 1 %\" , inline = \"01\" , group = \"⛔ SL & TP ⛔\")", 77 | "tp2_input = input.int( defval = 10 , title = \"TP 2 %\" , inline = \"01\" , group = \"⛔ SL & TP ⛔\")", 78 | "tp3_input = input.int( defval = 15 , title = \"TP 3 %\" , inline = \"01\" , group = \"⛔ SL & TP ⛔\")", 79 | "trailing_bool = input.bool( defval = false , title = \"Activate Trailing -> TP3 is amount, TP 2 is offset level\" , inline = \"03\" , group = \"⛔ SL & TP ⛔\")", 80 | "// # ======================== percent2point inputs =========================== #", 81 | "", 82 | "// # =========================== SL Calculation ============================== #", 83 | "sl = percent2points( sl_input )", 84 | "tp1 = percent2points( tp1_input )", 85 | "tp2 = percent2points( tp2_input )", 86 | "tp3 = percent2points( tp3_input )", 87 | "", 88 | "curProfitInPts() =>", 89 | " if strategy.position_size > 0", 90 | " (high - strategy.position_avg_price) / syminfo.mintick", 91 | " else if strategy.position_size < 0", 92 | " (strategy.position_avg_price - low) / syminfo.mintick", 93 | " else", 94 | " 0 ", 95 | "", 96 | "calcStopLossPrice(OffsetPts) =>", 97 | " if strategy.position_size > 0", 98 | " strategy.position_avg_price - OffsetPts * syminfo.mintick", 99 | " else if strategy.position_size < 0", 100 | " strategy.position_avg_price + OffsetPts * syminfo.mintick", 101 | " else", 102 | " na ", 103 | "", 104 | "calcProfitTrgtPrice(OffsetPts) =>", 105 | " calcStopLossPrice(-OffsetPts)", 106 | "", 107 | "getCurrentStage() =>", 108 | " var stage = 0", 109 | " if strategy.position_size == 0 ", 110 | " stage := 0", 111 | " if stage == 0 and strategy.position_size != 0", 112 | " stage := 1", 113 | " else if stage == 1 and curProfitInPts() >= tp1", 114 | " stage := 2", 115 | " else if stage == 2 and curProfitInPts() >= tp2", 116 | " stage := 3", 117 | " stage", 118 | "", 119 | "calcTrailingAmountLevel(points) =>", 120 | " var float level = na", 121 | " level := calcProfitTrgtPrice(points)", 122 | " if not na(level)", 123 | " if strategy.position_size > 0", 124 | " if not na(level[1])", 125 | " level := max(level[1], level)", 126 | " if not na(level)", 127 | " level := max(high, level)", 128 | " else if strategy.position_size < 0", 129 | " if not na(level[1])", 130 | " level := min(level[1], level)", 131 | " if not na(level)", 132 | " level := min(low, level)", 133 | "", 134 | "calcTrailingOffsetLevel(points, offset) =>", 135 | " float result = na", 136 | " amountLevel = calcTrailingAmountLevel(points)", 137 | " if strategy.position_size > 0", 138 | " trailActiveDiff = amountLevel - calcProfitTrgtPrice(points)", 139 | " if trailActiveDiff > 0", 140 | " result := trailActiveDiff + calcProfitTrgtPrice(offset)", 141 | " else if strategy.position_size < 0", 142 | " trailActiveDiff = calcProfitTrgtPrice(points) - amountLevel", 143 | " if trailActiveDiff > 0", 144 | " result := calcProfitTrgtPrice(offset) - trailActiveDiff", 145 | " result", 146 | "", 147 | "float stopLevel = na", 148 | "float trailOffsetLevel = na", 149 | "float profitLevel = trailing_bool ? calcTrailingAmountLevel(tp3) : calcProfitTrgtPrice(tp3)", 150 | "", 151 | "trailOffsetLevelTmp = calcTrailingOffsetLevel(tp3, tp2)", 152 | "", 153 | "curStage = getCurrentStage()", 154 | "if ActivateStopLoss", 155 | " if curStage == 1", 156 | " stopLevel := calcStopLossPrice(sl)", 157 | " strategy.exit(\"${1:ID LONG}\", loss = sl, profit = tp3, comment = \"SL or TP 3\")${2:", 158 | " strategy.exit(\"${3:ID SHORT}\", loss = sl, profit = tp3, comment = \"SL or TP 3\")}", 159 | " else if curStage == 2", 160 | " stopLevel := calcStopLossPrice(0)", 161 | " strategy.exit(\"$1\", stop = stopLevel, profit = tp3, comment = \"BH or TP 3\")${4:", 162 | " strategy.exit(\"$3\", stop = stopLevel, profit = tp3, comment = \"BH or TP 3\")}", 163 | " else if curStage == 3", 164 | " stopLevel := calcStopLossPrice(-tp1)", 165 | " if trailing_bool", 166 | " trailOffsetLevel := trailOffsetLevelTmp", 167 | " strategy.exit(\"$1\", stop = stopLevel, trail_points = tp3, trail_offset = tp3-tp2, comment = \"stop tp1 or trailing tp3 with offset tp2\")${5:", 168 | " strategy.exit(\"$3\", stop = stopLevel, trail_points = tp3, trail_offset = tp3-tp2, comment = \"stop tp1 or trailing tp3 with offset tp2\")}", 169 | " else", 170 | " strategy.exit(\"$1\", stop = stopLevel, profit = tp3, comment = \"tp1 or tp3\")${6:", 171 | " strategy.exit(\"$3\", stop = stopLevel, profit = tp3, comment = \"tp1 or tp3\")}", 172 | " else", 173 | " strategy.cancel(\"$1\")${7:", 174 | " strategy.cancel(\"$3\")}", 175 | "// # =========================== SL Calculation ============================== #${8:", 176 | "// URL https://www.tradingview.com/script/jjhUHcje-Stepped-trailing-strategy-example/}", 177 | "// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒* STOP LOSS *▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", 178 | "$0" 179 | ], 180 | "description": "Trailing SL & TP" 181 | } 182 | 183 | 184 | 185 | } -------------------------------------------------------------------------------- /snippets/unicode.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "Unicode Emojis ⇨ U": { 4 | "prefix": "unicode.emoji", 5 | "body": [ 6 | "${1| ,🌲,⛔,💬,🎨,⏱,🔴,🟠,🟡,🟢,🔵,🟣,🟤,⚫,⚪,🟥,🟧,🟨,🟩,🟦,🟪,🟫,⬛,⬜,🔶,🔷,🔸,🔹,🔺,🔻,💠,🔱,🔘,🔳,🔲,🏁,🚩,🎌,🏴,🏳️‍🌈,🏴‍☠️,📍,📌,📊,📉,📈,🌎,🌐,🧭,🌋,🚀,⌛,🌑,🌗,🌕,🌙,⭐,🌟,🌞,🪐,🌈,🌀,🧨,🎈,🔊,📢,📣,📯,🔔,🔋,🔍,💾,💰,💴,💸,📐,📏,🔒,🔓,🔑,🔐,🔨,⛓,🧲,📡,🩸,🗿,🛂,⛔,🚫,☢,☣,▶,⏯,🔂,🔀,📶,🔅,✖,➕,➖,➗,💲,💱,♻,📛,🔰,⭕,✅,✔,❌,❎,➰,™,#️⃣,*️⃣,0️⃣,1️⃣,2️⃣,3️⃣,4️⃣,5️⃣,6️⃣,7️⃣,8️⃣,9️⃣,🔟,🅰,🆎,🅱,🆑,🆗,🆙|}" 7 | ], 8 | "description": "Unicode Emojis" 9 | }, 10 | 11 | "Unicode URL List | Resource ⇨ U": { 12 | "prefix": "unicode.info", 13 | "body": [ 14 | "// ====================================================================================================#", 15 | "// ## https://blankcharacter.net/ | > Blank Character #", 16 | "// ----------------------------------------------------------------------------------------------------#", 17 | "// ## https://unicode.org/emoji/charts/full-emoji-list.html | > Unicode Emojis #", 18 | "// ----------------------------------------------------------------------------------------------------#", 19 | "// ## https://en.wikibooks.org/wiki/Unicode/List_of_useful_symbols | > Useful Symbols #", 20 | "// ----------------------------------------------------------------------------------------------------#", 21 | "// ## https://www.pinecoders.com/resources/ | > Pinecoders Resource #", 22 | "// ====================================================================================================#", 23 | "// ${1| ,🌲,⛔,💬,🎨,⏱,🔴,🟠,🟡,🟢,🔵,🟣,🟤,⚫,⚪,🟥,🟧,🟨,🟩,🟦,🟪,🟫,⬛,⬜,🔶,🔷,🔸,🔹,🔺,🔻,💠,🔱,🔘,🔳,🔲,🏁,🚩,🎌,🏴,🏳️‍🌈,🏴‍☠️,📍,📌,📊,📉,📈,🌎,🌐,🧭,🌋,🚀,⌛,🌑,🌗,🌕,🌙,⭐,🌟,🌞,🪐,🌈,🌀,🧨,🎈,🔊,📢,📣,📯,🔔,🔋,🔍,💾,💰,💴,💸,📐,📏,🔒,🔓,🔑,🔐,🔨,⛓,🧲,📡,🩸,🗿,🛂,⛔,🚫,☢,☣,▶,⏯,🔂,🔀,📶,🔅,✖,➕,➖,➗,💲,💱,♻,📛,🔰,⭕,✅,✔,❌,❎,➰,™,#️⃣,*️⃣,0️⃣,1️⃣,2️⃣,3️⃣,4️⃣,5️⃣,6️⃣,7️⃣,8️⃣,9️⃣,🔟,🅰,🆎,🅱,🆑,🆗,🆙,♯,☉,☼,☀,✗,✓,🠐,🠒 ,🠑,🠓,🡔,🡕,🡖,🡗,⇦,⇨,⇧,⇩,⤺,⤻,⤹,⤸,⇤,⇥,⤒,⤓,↨,⇆,⇄,⇅,⇵,➢,➣,➤,↚,↛,↮,↯,⭍,↞,↠,↟,↡,⯬,⯭,⯮,⯯,➳,➵,➴,➶,➸,➷|}", 24 | "${0}" 25 | ], 26 | "description": "Unicode URL List | Resource" 27 | }, 28 | 29 | "Unicode Symbols ⇨ U": { 30 | "prefix": "unicode.symbol", 31 | "body": [ 32 | "${1| ,♯,☉,☼,☀,✗,✓,🠐,🠒 ,🠑,🠓,🡔,🡕,🡖,🡗,⇦,⇨,⇧,⇩,⤺,⤻,⤹,⤸,⇤,⇥,⤒,⤓,↨,⇆,⇄,⇅,⇵,➢,➣,➤,↚,↛,↮,↯,⭍,↞,↠,↟,↡,⯬,⯭,⯮,⯯,➳,➵,➴,➶,➸,➷|}" 33 | ], 34 | "description": "Unicode Symbols" 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /snippets/words.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "alert_message = 𝑥": { 4 | "prefix": "alert_message", 5 | "body": [ 6 | "alert_message = ${1:\"${2}\"}" 7 | ], 8 | "description": "alert_message = " 9 | }, 10 | 11 | "backtest_fill_limits_assumption = 𝑥": { 12 | "prefix": "backtest_fill_limits_assumption", 13 | "body": [ 14 | "backtest_fill_limits_assumption = ${1| ,true,false|}" 15 | ], 16 | "description": "backtest_fill_limits_assumption = 𝑥" 17 | }, 18 | 19 | "bgcolor = 𝑥": { 20 | "prefix": "bgcolor", 21 | "body": [ 22 | "bgcolor = color.new(color = ${1| ,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow|}, transp = ${2:0})${0}" 23 | ], 24 | "description": "bgcolor = color.new(color = , transp = )" 25 | }, 26 | 27 | 28 | "bordercolor = 𝑥": { 29 | "prefix": "bordercolor", 30 | "body": [ 31 | "bordercolor = color.new(color = ${1| ,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow|}, transp = ${2:0})$0" 32 | ], 33 | "description": "bordercolor = 𝑥" 34 | }, 35 | 36 | "calc_on_order_fills = 𝑥": { 37 | "prefix": "calc_on_order_fills", 38 | "body": [ 39 | "calc_on_order_fills = ${1| ,true,false|}" 40 | ], 41 | "description": "calc_on_order_fills = 𝑥" 42 | }, 43 | 44 | "char = 𝑥": { 45 | "prefix": "char", 46 | "body": [ 47 | "char = \"${1| ,♯,☉,☼,☀,✗,✓,🠐,🠒 ,🠑,🠓,🡔,🡕,🡖,🡗,⇦,⇨,⇧,⇩,⤺,⤻,⤹,⤸,⇤,⇥,⤒,⤓,↨,⇆,⇄,⇅,⇵,➢,➣,➤,↚,↛,↮,↯,⭍,↞,↠,↟,↡,⯬,⯭,⯮,⯯,➳,➵,➴,➶,➸,➷|}\"" 48 | ], 49 | "description": "char = 𝑥" 50 | }, 51 | 52 | "close_entries_rule = 𝑥": { 53 | "prefix": "close_entries_rule", 54 | "body": [ 55 | "close_entries_rule = ${1| ,'FIFO','ANY'|}" 56 | ], 57 | "description": "close_entries_rule = 𝑥" 58 | }, 59 | 60 | "color = 𝑥": { 61 | "prefix": "color", 62 | "body": [ 63 | "color = color.new(color = ${1| ,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow|}, transp = ${2:0})${0}" 64 | ], 65 | "description": "color = color.new(color = , transp = )" 66 | }, 67 | 68 | "comment = 𝑥": { 69 | "prefix": "comment", 70 | "body": [ 71 | "comment = \"${1}\"" 72 | ], 73 | "description": "comment = 𝑥" 74 | }, 75 | 76 | "commission_type = 𝑥": { 77 | "prefix": "commission_type", 78 | "body": [ 79 | "commission_type = ${1| ,strategy.commission.percent,strategy.commission.cash_per_contract,strategy.commission.cash_per_order|}" 80 | ], 81 | "description": "commission_type = 𝑥" 82 | }, 83 | 84 | "currency = 𝑥": { 85 | "prefix": "currency", 86 | "body": [ 87 | "currency = ${1| ,currency.NONE,currency.USD,currency.EUR,currency.AUD,currency.GBP,currency.NZD,currency.CAD,currency.CHF,currency.HKD,currency.JPY,currency.NOK,currency.SEK,currency.SGD,currency.TRY,currency.ZAR|}" 88 | ], 89 | "description": "currency = 𝑥" 90 | }, 91 | 92 | "default_qty_type = 𝑥": { 93 | "prefix": "default_qty_type", 94 | "body": [ 95 | "default_qty_type = ${1| ,strategy.fixed,strategy.cash,strategy.percent_of_equity|}" 96 | ], 97 | "description": "default_qty_type = 𝑥" 98 | }, 99 | 100 | "defval = 𝑥": { 101 | "prefix": "defval", 102 | "body": [ 103 | "defval = ${1}, ${0}" 104 | ], 105 | "description": "defval = 𝑥" 106 | }, 107 | 108 | "display = 𝑥": { 109 | "prefix": "display", 110 | "body": [ 111 | "display = ${1| ,display.none,display.all|}" 112 | ], 113 | "description": "display = 𝑥" 114 | }, 115 | 116 | "editable = 𝑥": { 117 | "prefix": "editable", 118 | "body": [ 119 | "editable = ${1| ,true,false|}" 120 | ], 121 | "description": "editable = 𝑥" 122 | }, 123 | 124 | "explicit_plot_zorder = 𝑥": { 125 | "prefix": ["explicit_plot_zorder"], 126 | "body": [ 127 | "explicit_plot_zorder = ${1| ,true,false|}" 128 | ], 129 | "description": "explicit_plot_zorder = 𝑥" 130 | }, 131 | 132 | "export 𝑓 ⇨ 𝑥": { 133 | "prefix": ["export", "library.function"], 134 | "body": [ 135 | "export ${1/ /_/g} (${2:} ${3| ,int,float,bool,table,color|} ${4:} = ${5:[]}${6:, ${7:[𝑥]}}) =>", 136 | " ${8:}" 137 | ], 138 | "description": "export function_name() => \\n\\t " 139 | }, 140 | 141 | "field = 𝑥": { 142 | "prefix": "field", 143 | "body": [ 144 | "field = ${1| ,dividends.gross,divdends.net|}" 145 | ], 146 | "description": "field = 𝑥" 147 | }, 148 | 149 | "format = 𝑥": { 150 | "prefix": "format", 151 | "body": [ 152 | "format = ${1| ,format.inherit,format.price,format.value|}" 153 | ], 154 | "description": "format = 𝑥" 155 | }, 156 | 157 | "formatString = 𝑥": { 158 | "prefix": "formatString", 159 | "body": [ 160 | "formatString = \"${1}\"" 161 | ], 162 | "description": "formatString = 𝑥" 163 | }, 164 | 165 | "freq = 𝑥": { 166 | "prefix": "freq =", 167 | "body": [ 168 | "freq = ${1| ,alert.freq_all,alert.freq_once_per_bar,alert.freq_once_per_bar_close|}" 169 | ], 170 | "description": "field = 𝑥" 171 | }, 172 | 173 | "from_entry = 𝑥": { 174 | "prefix": "from_entry", 175 | "body": [ 176 | "from_entry = \"${1}\"" 177 | ], 178 | "description": "from_entry = 𝑥" 179 | }, 180 | 181 | "gaps = 𝑥": { 182 | "prefix": "gaps", 183 | "body": [ 184 | "gaps = ${1| ,barmerge.gaps_off,barmerge.gaps_on|}" 185 | ], 186 | "description": "gaps = 𝑥" 187 | }, 188 | 189 | "group = 𝑥": { 190 | "prefix": "group", 191 | "body": [ 192 | "group = ${1| ,\"🌲 🌲\",\"⛔ ⛔\",\"💬 💬\",\"🎨 🎨\",\"⏱ ⏱\",\"🔴 🔴\",\"🟠 🟠\",\"🟡 🟡\",\"🟢 🟢\",\"🔵 🔵\",\"🟣 🟣\",\"🟤 🟤\",\"⚫ ⚫\",\"⚪ ⚪\",\"🟥 🟥\",\"🟧 🟧\",\"🟨 🟨\",\"🟩 🟩\",\"🟦 🟦\",\"🟪 🟪\",\"🟫 🟫\",\"⬛ ⬛\",\"⬜ ⬜\",\"🔶 🔶\",\"🔷 🔷\",\"🔸 🔸\",\"🔹 🔹\",\"🔺 🔺\",\"🔻 🔻\",\"💠 💠\",\"🔱 🔱\",\"🔘 🔘\",\"🔳 🔳\",\"🔲 🔲\",\"🏁 🏁\",\"🚩 🚩\",\"🎌 🎌\",\"🏴 🏴\",\"🏳️‍🌈 🏳️‍🌈\",\"🏴‍☠️ 🏴‍☠️\",\"📍 📍\",\"📌 📌\",\"📊 📊\",\"📉 📉\",\"📈 📈\",\"🌎 🌎\",\"🌐 🌐\",\"🧭 🧭\",\"🌋 🌋\",\"🚀 🚀\",\"⌛ ⌛\",\"🌑 🌑\",\"🌗 🌗\",\"🌕 🌕\",\"🌙 🌙\",\"⭐ ⭐\",\"🌟 🌟\",\"🌞 🌞\",\"🪐 🪐\",\"🌈 🌈\",\"🌀 🌀\",\"🧨 🧨\",\"🎈 🎈\",\"🔊 🔊\",\"📢 📢\",\"📣 📣\",\"📯 📯\",\"🔔 🔔\",\"🔋 🔋\",\"🔍 🔍\",\"💾 💾\",\"💰 💰\",\"💴 💴\",\"💸 💸\",\"📐 📐\",\"📏 📏\",\"🔒 🔒\",\"🔓 🔓\",\"🔑 🔑\",\"🔐 🔐\",\"🔨 🔨\",\"⛓ ⛓\",\"🧲 🧲\",\"📡 📡\",\"🩸 🩸\",\"🗿 🗿\",\"🛂 🛂\",\"⛔ ⛔\",\"🚫 🚫\",\"☢ ☢\",\"☣ ☣\",\"▶ ▶\",\"⏯ ⏯\",\"🔂 🔂\",\"🔀 🔀\",\"📶 📶\",\"🔅 🔅\",\"✖ ✖\",\"➕ ➕\",\"➖ ➖\",\"➗ ➗\",\"💲 💲\",\"💱 💱\",\"♻ ♻\",\"📛 📛\",\"🔰 🔰\",\"⭕ ⭕\",\"✅ ✅\",\"✔ ✔\",\"❌ ❌\",\"❎ ❎\",\"➰ ➰\",\"™ ™\",\"#️⃣ #️⃣\",\"*️⃣ *️⃣\",\"0️⃣ 0️⃣\",\"1️⃣ 1️⃣\",\"2️⃣ 2️⃣\",\"3️⃣ 3️⃣\",\"4️⃣ 4️⃣\",\"5️⃣ 5️⃣\",\"6️⃣ 6️⃣\",\"7️⃣ 7️⃣\",\"8️⃣ 8️⃣\",\"9️⃣ 9️⃣\",\"🔟 🔟\",\"🅰 🅰\",\"🆎 🆎\",\"🅱 🅱\",\"🆑 🆑\",\"🆗 🆗\",\"🆙 🆙\",\"🟣 Backtesting Start 🟢\",\"🟣 Backtesting End ❎\",\"🟢 Entry 🟢\",\"❎ Exit ❎\",\"⛔ Exit ⛔\",\"🔵 Colors 🔵\",\"💬 Comments 💬\",\"🎨 Drawings 🎨\",\"🟤 Length 🟤\",\"🟢 Long 🟢\",\"⚪ Options ⚪\",\"⏱ Session ⏱\",\"🟠 Settings 🟠\",\"🔴 Short 🔴\",\"🌲 Source 🌲\",\"🔶 Statistics 🔶\",\"🟤 Strategy 🟤\",\"🔱 Symbol 🔱\",\"⏱ Timeframe ⏱\"|}${0}" 193 | ], 194 | "description": "group =" 195 | }, 196 | 197 | "ignore_invalid_symbol = 𝑥": { 198 | "prefix": "ignore_invalid_symbol ", 199 | "body": [ 200 | "ignore_invalid_symbol = ${1| ,true,false|}" 201 | ], 202 | "description": "ignore_invalid_symbol = 𝑥" 203 | }, 204 | 205 | "import ⇨ 𝑓𝑥": { 206 | "prefix": "import", 207 | "body": [ 208 | "// <<<=======================================================================<<<", 209 | "// Importing Function | $4 |", 210 | "// >>>----------------------------------------------------------------------->>>", 211 | "import ${1:username}/${2:libraryName}/1 as ${3:alias}", 212 | "// <<<-----------------------------------------------------------------------<<<", 213 | "// Importing Function | $4 |", 214 | "// >>>=======================================================================>>>", 215 | "", 216 | "f_$3_$4 = $3.${4:functionName}(${5:${6:}${7:, ${8:}}})", 217 | "$0" 218 | ], 219 | "description": "import {username}/{libraryName}/{libraryVersion} as {alias}" 220 | }, 221 | 222 | "inline = 𝑥": { 223 | "prefix": "inline", 224 | "body": [ 225 | "inline = \"${1| ,00,01,02,03,04,05,06,07,08,09,10,AA,AB,AC,AD,AE,AF,BA,BB,BC,BD,BE,BF,CA,CB,CC,CD,CE,CF|}\"" 226 | ], 227 | "description": "inline = \"..\"" 228 | }, 229 | 230 | "join = 𝑥": { 231 | "prefix": "join", 232 | "body": [ 233 | "join = ${1| ,true,false|}" 234 | ], 235 | "description": "join = 𝑥" 236 | }, 237 | 238 | "linestyle = 𝑥": { 239 | "prefix": "linestyle", 240 | "body": [ 241 | "linestyle = ${1| ,hline.style_solid,hline.style_dotted,hline.style_dashed|}" 242 | ], 243 | "description": "linestyle = 𝑥" 244 | }, 245 | 246 | "location = 𝑥": { 247 | "prefix": "location", 248 | "body": [ 249 | "location = ${1| ,location.abovebar,location.belowbar,location.top,location.bottom,location.absolute|}" 250 | ], 251 | "description": "location = 𝑥" 252 | }, 253 | 254 | "lookahead = 𝑥": { 255 | "prefix": "lookahead", 256 | "body": [ 257 | "lookahead = ${1| ,barmerge.lookahead_off,barmerge.lookahead_on|}" 258 | ], 259 | "description": "lookahead = 𝑥" 260 | }, 261 | 262 | "message = 𝑥": { 263 | "prefix": "message", 264 | "body": [ 265 | "message = \"${1}\"" 266 | ], 267 | "description": "message = 𝑥" 268 | }, 269 | 270 | "order = 𝑥": { 271 | "prefix": "order", 272 | "body": [ 273 | "order = ${1| ,order.ascending,order.descending|}$0" 274 | ], 275 | "description": "order = 𝑥" 276 | }, 277 | 278 | "overlay = 𝑥": { 279 | "prefix": "overlay", 280 | "body": [ 281 | "overlay = ${1| ,true,false|}" 282 | ], 283 | "description": "overlay = 𝑥" 284 | }, 285 | 286 | "position = 𝑥": { 287 | "prefix": "position.", 288 | "body": [ 289 | "position = ${1| ,position.top_left,position.top_center,position.top_right,position.middle_left,position.middle_center,position.middle_right,position.bottom_left,position.bottom_center,position.bottom_right|}" 290 | ], 291 | "description": "position = 𝑥" 292 | }, 293 | 294 | "process_orders_on_close = 𝑥": { 295 | "prefix": "process_orders_on_close.", 296 | "body": [ 297 | "process_orders_on_close = ${1| ,true,false|}" 298 | ], 299 | "description": "process_orders_on_close = 𝑥" 300 | }, 301 | 302 | "scale = 𝑥": { 303 | "prefix": "scale", 304 | "body": [ 305 | "scale = ${1| ,scale.right,scale.left,scale.none|}" 306 | ], 307 | "description": "scale = 𝑥" 308 | }, 309 | 310 | "separator = 𝑥": { 311 | "prefix": "separator", 312 | "body": [ 313 | "separator = \"${1}\"" 314 | ], 315 | "description": "separator = 𝑥" 316 | }, 317 | 318 | "shorttitle = 𝑥": { 319 | "prefix": "shorttitle", 320 | "body": [ 321 | "shorttitle = \"${1}\"" 322 | ], 323 | "description": "shorttitle = 𝑥" 324 | }, 325 | 326 | "size = 𝑥": { 327 | "prefix": "size", 328 | "body": [ 329 | "size = ${1| ,size.auto,size.tiny,size.small,size.normal,size.large,size.huge|}" 330 | ], 331 | "description": "size = 𝑥" 332 | }, 333 | 334 | "style = 𝑥": { 335 | "prefix": "style", 336 | "body": [ 337 | "style = ${1| ,plot.style_line,plot.style_stepline,plot.style_stepline_diamond,plot.style_histogram,plot.style_cross,plot.style_area,plot.style_columns,plot.style_circles, ,label.style_none,label.style_xcross,label.style_cross,label.style_triangleup,label.style_triangledown,label.style_flag,label.style_circle,label.style_arrowup,label.style_arrowdown,label.style_label_up,label.style_label_down,label.style_label_left,label.style_label_right,label.style_label_lower_left,label.style_label_lower_right,label.style_label_upper_left,label.style_label_upper_right,label.style_label_center,label.style_square,label.style_diamond, ,line.style_solid,line.style_dotted,line.style_dashed,line.style_arrow_left,line.style_arrow_right,line.style_arrow_both, ,shape.xcross,shape.cross,shape.triangleup,shape.triangledown,shape.flag,shape.circle,shape.arrowup,shape.arrowdown,shape.labelup,shape.labeldown,shape.square,shape.diamond|}" 338 | ], 339 | "description": "style = 𝑥" 340 | }, 341 | 342 | "textalign = 𝑥": { 343 | "prefix": "textalign", 344 | "body": [ 345 | "textalign = ${1| ,text.align_left,text.align_center,text.align_right|}" 346 | ], 347 | "description": "textalign = 𝑥" 348 | }, 349 | 350 | "text_halign = 𝑥": { 351 | "prefix": "text_halign", 352 | "body": [ 353 | "text_halign = ${1| ,text.align_left,text.align_center,text.align_right|}" 354 | ], 355 | "description": "text_halign = 𝑥" 356 | }, 357 | 358 | "text_size = 𝑥": { 359 | "prefix": "text_size", 360 | "body": [ 361 | "text_size = ${1| ,size.auto,size.tiny,size.small,size.normal,size.large,size.huge|}" 362 | ], 363 | "description": "text_size = 𝑥" 364 | }, 365 | 366 | "text_valign = 𝑥": { 367 | "prefix": "text_valign", 368 | "body": [ 369 | "text_valign = ${1| ,text.align_top,text.align_center,text.align_bottom|}" 370 | ], 371 | "description": "text_valign = 𝑥" 372 | }, 373 | 374 | "ticker = 𝑥": { 375 | "prefix": "ticker", 376 | "body": [ 377 | "ticker = ${1| ,syminfo.ticker,syminfo.tickerid|}" 378 | ], 379 | "description": "ticker = 𝑥" 380 | }, 381 | 382 | "timeframe = 𝑥": { 383 | "prefix": "timeframe", 384 | "body": [ 385 | "timeframe = \"${1}\"" 386 | ], 387 | "description": "timeframe = 𝑥" 388 | }, 389 | 390 | "timezone = 𝑥": { 391 | "prefix": "timezone", 392 | "body": [ 393 | "timezone = ${1| ,\"GMT-12\",\"GMT-11\",\"GMT-10\",\"GMT-9\",\"GMT-8\",\"GMT-7\",\"GMT-6\",\"GMT-5\",\"GMT-4\",\"GMT-3\",\"GMT-2\",\"GMT-1\",\"GMT+0\",\"GMT+1\",\"GMT+2\",\"GMT+3\",\"GMT+4\",\"GMT+5\",\"GMT+6\",\"GMT+7\",\"GMT+8\",\"GMT+9\",\"GMT+10\",\"GMT+11\",\"GMT+12\"|}" 394 | ], 395 | "description": "timezone = \"GMT±..\"" 396 | }, 397 | 398 | "title = 𝑥": { 399 | "prefix": "title", 400 | "body": [ 401 | "title = \"${1}\"" 402 | ], 403 | "description": "title = 𝑥" 404 | }, 405 | 406 | "tooltip = 𝑥": { 407 | "prefix": "tooltip", 408 | "body": [ 409 | "tooltip = \"${1}\"$0" 410 | ], 411 | "description": "tooltip = 𝑥" 412 | }, 413 | 414 | "{\"\"} tooltip = 𝑥": { 415 | "prefix": "tooltip", 416 | "body": [ 417 | "${1:name}_tooltip = ", 418 | " \"${2}\" ${3:+ \"\\n\" +${4: \"\\n\" +}", 419 | " \"${5}\" ${6:+ \"\\n\" +${7: \"\\n\" +}", 420 | " \"${8}\" ${9:+ \"\\n\" +${10:\"\\n\" +}", 421 | " \"${11}\"}}}", 422 | "$0" 423 | ], 424 | "description": "new tooltip" 425 | }, 426 | 427 | "tooltip {𝑥} text = 𝑥": { 428 | "prefix": "tooltip.text", 429 | "body": [ 430 | " \"${1}\" ${2:+ \"\\n\" +${3: \"\\n\" +}}", 431 | "$0" 432 | ], 433 | "description": "tooltip {\\n\\s} text = 𝑥" 434 | }, 435 | 436 | "trackprice = 𝑥": { 437 | "prefix": "trackprice", 438 | "body": [ 439 | "trackprice = ${1| ,true,false|}" 440 | ], 441 | "description": "trackprice = 𝑥" 442 | }, 443 | 444 | "wickcolor = 𝑥": { 445 | "prefix": "wickcolor", 446 | "body": [ 447 | "wickcolor = color.new(color = ${1| ,color.aqua,color.black,color.blue,color.fuchsia,color.gray,color.green,color.lime,color.maroon,color.navy,color.olive,color.orange,color.purple,color.red,color.silver,color.teal,color.white,color.yellow|}, transp = ${2:0})$0" 448 | ], 449 | "description": "wickcolor = 𝑥" 450 | }, 451 | 452 | "xloc = 𝑥": { 453 | "prefix": "xloc", 454 | "body": [ 455 | "xloc = ${1| ,xloc.bar_index,xloc.bar_time|}", 456 | "", 457 | "$0" 458 | ], 459 | "description": "xloc = 𝑥" 460 | }, 461 | 462 | "//@version=5": { 463 | "prefix": ["//", "version"], 464 | "body": [ 465 | "//@version=5", 466 | "", 467 | "$0" 468 | ], 469 | "description": "//@version=5" 470 | }, 471 | 472 | "@ 𝑥": { 473 | "prefix": "library.compilers", 474 | "body": [ 475 | "// ===========================================================================*", 476 | "// * >* The ${1} Function *<", 477 | "// *==========================================================================*", 478 | "// @function ${2:}", 479 | "// @param ${3: }", 480 | "// @returns ${4:}${5:", 481 | "// *==========================================================================*", 482 | "// * > 1. ${6}${7:", 483 | "// * > 2. ${8}}${9:", 484 | "// * > 3. ${10}}${11:", 485 | "// * > 4. ${12}}${13:", 486 | "// * > 5. ${14}}", 487 | "// *==========================================================================*}", 488 | "${0}" 489 | ], 490 | "description": "@(function|param|returns) ..." 491 | } 492 | 493 | } -------------------------------------------------------------------------------- /src/test/runTest.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | 3 | import { runTests } from '@vscode/test-electron'; 4 | 5 | async function main() { 6 | try { 7 | // The folder containing the Extension Manifest package.json 8 | // Passed to `--extensionDevelopmentPath` 9 | const extensionDevelopmentPath = path.resolve(__dirname, '../../'); 10 | 11 | // The path to test runner 12 | // Passed to --extensionTestsPath 13 | const extensionTestsPath = path.resolve(__dirname, './suite/index'); 14 | 15 | // Download VS Code, unzip it and run the integration test 16 | await runTests({ extensionDevelopmentPath, extensionTestsPath }); 17 | } catch (err) { 18 | console.error('Failed to run tests'); 19 | process.exit(1); 20 | } 21 | } 22 | 23 | main(); 24 | -------------------------------------------------------------------------------- /src/test/suite/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /src/test/suite/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as Mocha from 'mocha'; 3 | import * as glob from 'glob'; 4 | 5 | export function run(): Promise { 6 | // Create the mocha test 7 | const mocha = new Mocha({ 8 | ui: 'tdd', 9 | color: true 10 | }); 11 | 12 | const testsRoot = path.resolve(__dirname, '..'); 13 | 14 | return new Promise((c, e) => { 15 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { 16 | if (err) { 17 | return e(err); 18 | } 19 | 20 | // Add files to the test suite 21 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); 22 | 23 | try { 24 | // Run the mocha test 25 | mocha.run(failures => { 26 | if (failures > 0) { 27 | e(new Error(`${failures} tests failed.`)); 28 | } else { 29 | c(); 30 | } 31 | }); 32 | } catch (err) { 33 | console.error(err); 34 | e(err); 35 | } 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /src/variables.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | export function activate(context: vscode.ExtensionContext) { 4 | 5 | let pineHover00 = vscode.languages.registerHoverProvider('pine', { 6 | provideHover(document, position, token) { 7 | let hoverRange00; 8 | const hoverLineText00 = document.lineAt(position.line).text; 9 | 10 | 11 | const comment1 = new vscode.MarkdownString(``); 12 | comment1.appendCodeblock("// comment"); 13 | comment1.isTrusted = true; 14 | comment1.supportHtml = true; 15 | 16 | const commentPattern1 = new RegExp("//.*"); 17 | if (commentPattern1.test(hoverLineText00)) { 18 | hoverRange00 = document.getWordRangeAtPosition(position, commentPattern1); 19 | if (hoverRange00) { 20 | return new vscode.Hover(comment1, new vscode.Range(position, position)); 21 | } 22 | else { 23 | return null; 24 | } 25 | } 26 | } 27 | }); 28 | context.subscriptions.push(pineHover00); 29 | 30 | } 31 | 32 | // this method is called when your extension is deactivated 33 | export function deactivate() {} 34 | function activeTextEditor(activeTextEditor: any) { 35 | throw new Error('Function not implemented.'); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /syntaxes/index.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Firestore Index Definitions", 3 | "type": "object", 4 | "properties": { 5 | "indexes": { 6 | "type": "array", 7 | "items": { 8 | "type": "object", 9 | "properties": { 10 | "collectionGroup": { 11 | "type": "string", 12 | "pattern": "^[a-zA-Z0-9_]+$", 13 | "description": "The collection group ID to which this index applies." 14 | }, 15 | "queryScope": { 16 | "enum": ["COLLECTION", "COLLECTION_GROUP"], 17 | "description": "The query scope to which this index applies." 18 | }, 19 | "fields": { 20 | "type": "array", 21 | "items": { 22 | "type": "object", 23 | "properties": { 24 | "fieldPath": { 25 | "type": "string", 26 | "pattern": "^[a-zA-Z0-9_/.]+$", 27 | "description": "The path of the field. Special field paths __name__, __type__, and __scatter__ may be used." 28 | }, 29 | "order": { 30 | "enum": ["ASCENDING", "DESCENDING"], 31 | "description": "The order determines how a field is indexed." 32 | }, 33 | "arrayConfig": { 34 | "enum": ["CONTAINS"], 35 | "description": "The arrayConfig determines how an array field is indexed." 36 | } 37 | }, 38 | "uniqueItems": true, 39 | "required": ["fieldPath"] 40 | }, 41 | "minItems": 1 42 | } 43 | }, 44 | "required": ["collectionGroup", "queryScope", "fields"] 45 | }, 46 | "minItems": 0 47 | }, 48 | "fieldOverrides": { 49 | "type": "array", 50 | "items": { 51 | "type": "object", 52 | "properties": { 53 | "collectionGroup": { 54 | "type": "string", 55 | "pattern": "^[a-zA-Z0-9_]+$", 56 | "description": "The collection group ID to which this field override applies." 57 | }, 58 | "fieldPath": { 59 | "type": "string", 60 | "pattern": "^[a-zA-Z0-9_/.]+$", 61 | "description": "The field path to which this field override applies." 62 | }, 63 | "indexes": { 64 | "type": "array", 65 | "items": { 66 | "type": "object", 67 | "properties": { 68 | "queryScope": { 69 | "enum": ["COLLECTION", "COLLECTION_GROUP"], 70 | "description": "The query scope to which this index applies." 71 | }, 72 | "order": { 73 | "enum": ["ASCENDING", "DESCENDING"], 74 | "description": "The order determines how a field is indexed." 75 | }, 76 | "arrayConfig": { 77 | "enum": ["CONTAINS"], 78 | "description": "The arrayConfig determines how an array field is indexed." 79 | } 80 | }, 81 | "uniqueItems": true, 82 | "required": ["order", "queryScope"] 83 | }, 84 | "minItems": 0 85 | } 86 | }, 87 | "required": ["collectionGroup", "queryScope", "fields"] 88 | }, 89 | "minItems": 0 90 | } 91 | }, 92 | "required": ["indexes"] 93 | } 94 | -------------------------------------------------------------------------------- /syntaxes/ps.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", 3 | "name": "Pine Script", 4 | "patterns": [ 5 | { 6 | "match": "(||||)", 7 | "name": "comment.line.double-slash.ps" 8 | }, 9 | { 10 | "match": "(^\/\/)\\s*(©)\\s*(\\w+)(.*)", 11 | "captures": { 12 | "0": { 13 | "name": "comment.line.double-slash.ps" 14 | }, 15 | "1": { 16 | "name": "comment.line.double-slash.ps" 17 | }, 18 | "2": { 19 | "name": "comment.line.double-slash.ps" 20 | }, 21 | "3": { 22 | "name": "constant.numeric.ps" 23 | }, 24 | "4": { 25 | "name": "comment.line.double-slash.ps" 26 | } 27 | } 28 | }, 29 | { 30 | "match": "(^\/\/)(@)(version)(=)(5)(.*)", 31 | "captures": { 32 | "0": { 33 | "name": "comment.line.double-slash.ps" 34 | }, 35 | "1": { 36 | "name": "comment.line.double-slash.ps" 37 | }, 38 | "2": { 39 | "name": "keyword.operator.logical.js.ps" 40 | }, 41 | 42 | "3": { 43 | "name": "token.error-token.ps" 44 | }, 45 | "4": { 46 | "name": "keyword.operator.logical.js.ps" 47 | }, 48 | "5": { 49 | "name": "constant.numeric.ps" 50 | } 51 | } 52 | }, 53 | { 54 | "match": "(^\/\/)\\s*(ⓘ)\\s*(https:\/\/www\\.tradingview\\.com)([\\w.,@?^=%&:\/~+#-\\{]*[\\}\\w@?^=%&\/~+#-])(\\w+)(.*)", 55 | "captures": { 56 | "0": { 57 | "name": "comment.line.double-slash.ps" 58 | }, 59 | "1": { 60 | "name": "comment.line.double-slash.ps" 61 | }, 62 | "2": { 63 | "name": "constant.numeric.ps" 64 | }, 65 | "3": { 66 | "name": "keyword.operator.logical.js.ps" 67 | }, 68 | "4": { 69 | "name": "keyword.operator.logical.js.ps" 70 | }, 71 | "5": { 72 | "name": "keyword.operator.logical.js.ps" 73 | } 74 | } 75 | }, 76 | { 77 | "match": "^(?:import)\\s*(\\w+)(?:\/)(\\w+)(?:\/)(\\w+)\\s*(?:as)\\s*(?\\w+)", 78 | "captures": { 79 | "0": { 80 | "name": "punctuation.section.embedded.begin.ps" 81 | }, 82 | "1": { 83 | "name": "keyword.operator.logical.js.ps" 84 | }, 85 | "2": { 86 | "name": "token.package.ps" 87 | }, 88 | "3": { 89 | "name": "constant.numeric.ps" 90 | }, 91 | "4": { 92 | "name": "storage.type.cs.ps" 93 | }, 94 | "5": { 95 | "name": "punctuation.definition.list.markdown.ps" 96 | } 97 | } 98 | }, 99 | { 100 | "match": "(^\/\/)(@)(version)(=)(5)(.*)", 101 | "captures": { 102 | "0": { 103 | "name": "comment.line.double-slash.ps" 104 | }, 105 | "1": { 106 | "name": "comment.line.double-slash.ps" 107 | }, 108 | "2": { 109 | "name": "keyword.operator.logical.ps" 110 | }, 111 | "3": { 112 | "name": "constant.numeric.ps" 113 | }, 114 | "4": { 115 | "name": "keyword.operator.logical.ps" 116 | }, 117 | "5": { 118 | "name": "punctuation.definition.list.markdown.ps" 119 | } 120 | } 121 | }, 122 | { 123 | "match": "(^\/\/).*(\\d{10})(.*)(#)", 124 | "captures": { 125 | "0": { 126 | "name": "comment.line.double-slash.ps" 127 | }, 128 | "1": { 129 | "name": "comment.line.double-slash.ps" 130 | }, 131 | "2": { 132 | "name": "punctuation.definition.list.markdown.ps" 133 | }, 134 | "3": { 135 | "name": "comment.line.double-slash.ps" 136 | } 137 | } 138 | }, 139 | { 140 | "match": "(^\/\/)\\s(@)(description|function|param|returns)(.*)", 141 | "captures": { 142 | "0": { 143 | "name": "invalid.illegal.ps" 144 | }, 145 | "1": { 146 | "name": "comment.line.double-slash.ps" 147 | }, 148 | "2": { 149 | "name": "punctuation.section.embedded.begin.ps" 150 | }, 151 | "3": { 152 | "name": "token.package.ps" 153 | }, 154 | "4": { 155 | "name": "comment.line.double-slash.ps" 156 | } 157 | } 158 | }, 159 | { 160 | "match": "(^\/\/).*(\\d{4}\\s\\w{3,10}\\s\\w{3,10}).*(\\|)\\s(\\d{2}:\\d{2}:\\d{2})(.*)(#)", 161 | "captures": { 162 | "0": { 163 | "name": "comment.line.double-slash.ps" 164 | }, 165 | "1": { 166 | "name": "comment.line.double-slash.ps" 167 | }, 168 | "2": { 169 | "name": "markup.italic.markdown.ps" 170 | }, 171 | "3": { 172 | "name": "comment.line.double-slash.ps" 173 | }, 174 | "4": { 175 | "name": "punctuation.definition.list.markdown.ps" 176 | }, 177 | "5": { 178 | "name": "invalid.illegal.ps" 179 | }, 180 | "6": { 181 | "name": "comment.line.double-slash.ps" 182 | } 183 | } 184 | }, 185 | { 186 | "match": "(^\/\/).*(\\d{2}-\\d{2}-\\d{2}).*(\\|)\\s(\\d{2}:\\d{2}:\\d{2})(.*)(#)", 187 | "captures": { 188 | "0": { 189 | "name": "comment.line.double-slash.ps" 190 | }, 191 | "1": { 192 | "name": "comment.line.double-slash.ps" 193 | }, 194 | "2": { 195 | "name": "markup.italic.markdown.ps" 196 | }, 197 | "3": { 198 | "name": "comment.line.double-slash.ps" 199 | }, 200 | "4": { 201 | "name": "punctuation.definition.list.markdown.ps" 202 | }, 203 | "5": { 204 | "name": "invalid.illegal.ps" 205 | }, 206 | "6": { 207 | "name": "comment.line.double-slash.ps" 208 | } 209 | } 210 | }, 211 | { 212 | "match": "(^\/\/).*(##)(.*)(\\|)\\s*(>)\\s*(.*)(#)", 213 | "captures": { 214 | "0": { 215 | "name": "comment.line.double-slash.ps" 216 | }, 217 | "1": { 218 | "name": "comment.line.double-slash.ps" 219 | }, 220 | "2": { 221 | "name": "markup.italic.markdown.ps" 222 | }, 223 | "3": { 224 | "name": "token.info-token.ps" 225 | }, 226 | "4": { 227 | "name": "comment.line.double-slash.ps" 228 | }, 229 | "5": { 230 | "name": "invalid.illegal.ps" 231 | }, 232 | "6": { 233 | "name": "punctuation.definition.list.markdown.ps" 234 | } 235 | } 236 | }, 237 | { 238 | "match": "//.*", 239 | "name": "comment.line.double-slash.ps" 240 | }, 241 | { 242 | "match": "[]\\[]", 243 | "name": "invalid.illegal.ps" 244 | }, 245 | { 246 | "include": "#strings" 247 | }, 248 | { 249 | "include": "#constants" 250 | }, 251 | { 252 | "include": "#functions" 253 | }, 254 | { 255 | "include": "#keywords" 256 | }, 257 | { 258 | "include": "#variables" 259 | }, 260 | { 261 | "include": "#operators" 262 | } 263 | ], 264 | "repository": { 265 | "strings": { 266 | "patterns": [ 267 | { 268 | "match": "\\b(export|import)\\b", 269 | "name": "punctuation.section.embedded.begin.ps" 270 | }, 271 | { 272 | "begin": "\"", 273 | "beginCaptures": { 274 | "1": { 275 | "name": "punctuation.definition.string.begin.ps" 276 | } 277 | }, 278 | "end": "\"", 279 | "endCaptures": { 280 | "1": { 281 | "name": "punctuation.definition.string.end.ps" 282 | } 283 | }, 284 | "name": "string.quoted.double.ps", 285 | "patterns": [ 286 | { 287 | "match": "\\\\.", 288 | "name": "constant.character.escaped.ps" 289 | } 290 | ] 291 | }, 292 | { 293 | "begin": "'", 294 | "beginCaptures": { 295 | "1": { 296 | "name": "punctuation.definition.string.begin.ps" 297 | } 298 | }, 299 | "end": "'", 300 | "endCaptures": { 301 | "1": { 302 | "name": "punctuation.definition.string.end.ps" 303 | } 304 | }, 305 | "name": "string.quoted.single.ps", 306 | "patterns": [ 307 | { 308 | "match": "\\\\.", 309 | "name": "constant.character.escaped.ps" 310 | } 311 | ] 312 | } 313 | ] 314 | }, 315 | "constants": { 316 | "patterns": [ 317 | { 318 | "begin": "\\b(adjustment)\\b(?!\\()(?=\\.)", 319 | "beginCaptures": { 320 | "1": { 321 | "name": "variable.other.ps" 322 | } 323 | }, 324 | "end": "\\b(dividends|none|splits)\\b", 325 | "endCaptures": { 326 | "1": { 327 | "name": "variable.other.ps" 328 | } 329 | } 330 | }, 331 | { 332 | "begin": "\\b(alert)\\b(?!\\()(?=\\.)", 333 | "beginCaptures": { 334 | "1": { 335 | "name": "variable.other.ps" 336 | } 337 | }, 338 | "end": "\\b(freq_all|freq_once_per_bar|freq_once_per_bar_close)\\b", 339 | "endCaptures": { 340 | "1": { 341 | "name": "variable.other.ps" 342 | } 343 | } 344 | }, 345 | { 346 | "begin": "\\b(barmerge)\\b(?!\\()(?=\\.)", 347 | "beginCaptures": { 348 | "1": { 349 | "name": "variable.other.ps" 350 | } 351 | }, 352 | "end": "\\b(gaps_off|gaps_on|lookahead_off|lookahead_on)\\b", 353 | "endCaptures": { 354 | "1": { 355 | "name": "variable.other.ps" 356 | } 357 | } 358 | }, 359 | { 360 | "begin": "\\b(barstate)\\b(?!\\()(?=\\.)", 361 | "beginCaptures": { 362 | "1": { 363 | "name": "variable.other.ps" 364 | } 365 | }, 366 | "end": "\\b(isconfirmed|isfirst|ishistory|islast|islastconfirmedhistory|isnew|isrealtime)\\b", 367 | "endCaptures": { 368 | "1": { 369 | "name": "variable.other.ps" 370 | } 371 | } 372 | }, 373 | { 374 | "match": "\\b(box.all)\\b", 375 | "name": "variable.other.ps" 376 | }, 377 | { 378 | "begin": "\\b(chart)\\b(?!\\()(?=\\.)", 379 | "beginCaptures": { 380 | "1": { 381 | "name": "variable.other.ps" 382 | } 383 | }, 384 | "end": "\\b(bg_color|fg_color)\\b", 385 | "endCaptures": { 386 | "1": { 387 | "name": "variable.other.ps" 388 | } 389 | } 390 | }, 391 | { 392 | "match": "(color)(\\.)(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)", 393 | "captures": { 394 | "0": { 395 | "name": "variable.other.ps" 396 | }, 397 | "1": { 398 | "name": "variable.other.ps" 399 | }, 400 | "2": { 401 | "name": "invalid.illegal" 402 | } 403 | } 404 | }, 405 | { 406 | "match": "(currency)(\\.)(AUD|CAD|CHF|EUR|GBP|HKD|JPY|NOK|NONE|NZD|RUB|SEK|SGD|TRY|USD|ZAR)", 407 | "captures": { 408 | "0": { 409 | "name": "variable.other.ps" 410 | }, 411 | "1": { 412 | "name": "variable.other.ps" 413 | }, 414 | "2": { 415 | "name": "invalid.illegal" 416 | } 417 | } 418 | }, 419 | { 420 | "match": "(dayofweek)(\\.)(friday|monday|saturday|sunday|thursday|tuesday|wednesday)", 421 | "captures": { 422 | "0": { 423 | "name": "variable.other.ps" 424 | }, 425 | "1": { 426 | "name": "variable.other.ps" 427 | }, 428 | "2": { 429 | "name": "invalid.illegal" 430 | } 431 | } 432 | }, 433 | { 434 | "match": "(display)(\\.)(all|none)", 435 | "captures": { 436 | "0": { 437 | "name": "variable.other.ps" 438 | }, 439 | "1": { 440 | "name": "variable.other.ps" 441 | }, 442 | "2": { 443 | "name": "invalid.illegal" 444 | } 445 | } 446 | }, 447 | { 448 | "match": "(dividends)(\\.)(gross|net)", 449 | "captures": { 450 | "0": { 451 | "name": "variable.other.ps" 452 | }, 453 | "1": { 454 | "name": "variable.other.ps" 455 | }, 456 | "2": { 457 | "name": "invalid.illegal" 458 | } 459 | } 460 | }, 461 | { 462 | "match": "(earnings)(\\.)(actual|estimate|standardized)", 463 | "captures": { 464 | "0": { 465 | "name": "variable.other.ps" 466 | }, 467 | "1": { 468 | "name": "variable.other.ps" 469 | }, 470 | "2": { 471 | "name": "invalid.illegal" 472 | } 473 | } 474 | }, 475 | { 476 | "match": "(extend)(\\.)(both|left|none|right)", 477 | "captures": { 478 | "0": { 479 | "name": "variable.other.ps" 480 | }, 481 | "1": { 482 | "name": "variable.other.ps" 483 | }, 484 | "2": { 485 | "name": "invalid.illegal" 486 | } 487 | } 488 | }, 489 | { 490 | "match": "(format)(\\.)(inherit|mintick|percent|price|volume)", 491 | "captures": { 492 | "0": { 493 | "name": "variable.other.ps" 494 | }, 495 | "1": { 496 | "name": "variable.other.ps" 497 | }, 498 | "2": { 499 | "name": "invalid.illegal" 500 | } 501 | } 502 | }, 503 | { 504 | "match": "(hline)(\\.)(style_dashed|style_dotted|style_solid)", 505 | "captures": { 506 | "0": { 507 | "name": "variable.other.ps" 508 | }, 509 | "1": { 510 | "name": "variable.other.ps" 511 | }, 512 | "2": { 513 | "name": "invalid.illegal" 514 | } 515 | } 516 | }, 517 | { 518 | "match": "(label)(\\.)(all|style_arrowdown|style_arrowup|style_circle|style_cross|style_diamond|style_flag|style_label_center|style_label_down|style_label_left|style_label_lower_left|style_label_lower_right|style_label_right|style_label_upper_left|style_label_upper_right|style_label_up|style_none|style_square|style_triangledown|style_triangleup|style_xcross)", 519 | "captures": { 520 | "0": { 521 | "name": "variable.other.ps" 522 | }, 523 | "1": { 524 | "name": "variable.other.ps" 525 | }, 526 | "2": { 527 | "name": "invalid.illegal" 528 | } 529 | } 530 | }, 531 | { 532 | "match": "(line)(\\.)(all|style_arrow_both|style_arrow_left|style_arrow_right|style_dashed|style_dotted|style_solid|style_solidline|style_dottedline|style_dashedline|style_arrow_leftline|style_arrow_rightline|style_arrow_bothline)", 533 | "captures": { 534 | "0": { 535 | "name": "variable.other.ps" 536 | }, 537 | "1": { 538 | "name": "variable.other.ps" 539 | }, 540 | "2": { 541 | "name": "invalid.illegal" 542 | } 543 | } 544 | }, 545 | { 546 | "match": "(location)(\\.)(abovebar|absolute|belowbar|bottom|top)", 547 | "captures": { 548 | "0": { 549 | "name": "variable.other.ps" 550 | }, 551 | "1": { 552 | "name": "variable.other.ps" 553 | }, 554 | "2": { 555 | "name": "invalid.illegal" 556 | } 557 | } 558 | }, 559 | { 560 | "match": "\\b(order)\\b(\\.)\\b(ascending|descending)\\b", 561 | "captures": { 562 | "0": { 563 | "name": "variable.other.ps" 564 | }, 565 | "1": { 566 | "name": "variable.other.ps" 567 | }, 568 | "2": { 569 | "name": "invalid.illegal" 570 | } 571 | } 572 | }, 573 | { 574 | "match": "\\b(plot)\\b(\\.)\\b(style_areabr|style_area|style_circles|style_columns|style_cross|style_histogram|style_line|style_linebr|style_stepline|style_stepline_diamond)\\b", 575 | "captures": { 576 | "0": { 577 | "name": "variable.other.ps" 578 | }, 579 | "1": { 580 | "name": "variable.other.ps" 581 | }, 582 | "2": { 583 | "name": "invalid.illegal" 584 | } 585 | } 586 | }, 587 | { 588 | "match": "\\b(position)\\b(\\.)\\b(bottom_center|bottom_left|bottom_right|middle_center|middle_left|middle_right|top_center|top_left|top_right)\\b", 589 | "captures": { 590 | "0": { 591 | "name": "variable.other.ps" 592 | }, 593 | "1": { 594 | "name": "variable.other.ps" 595 | }, 596 | "2": { 597 | "name": "invalid.illegal" 598 | } 599 | } 600 | }, 601 | { 602 | "match": "\\b(scale)\\b(\\.)\\b(left|none|right)\\b", 603 | "captures": { 604 | "0": { 605 | "name": "variable.other.ps" 606 | }, 607 | "1": { 608 | "name": "variable.other.ps" 609 | }, 610 | "2": { 611 | "name": "invalid.illegal" 612 | } 613 | } 614 | }, 615 | { 616 | "match": "\\b(session)\\b(\\.)\\b(extended|ismarket|ispostmarket|ispremarket|regular)\\b", 617 | "captures": { 618 | "0": { 619 | "name": "variable.other.ps" 620 | }, 621 | "1": { 622 | "name": "variable.other.ps" 623 | }, 624 | "2": { 625 | "name": "invalid.illegal" 626 | } 627 | } 628 | }, 629 | { 630 | "match": "\\b(shape)\\b(\\.)\\b(arrowdown|arrowup|circle|cross|diamond|flag|labeldown|labelup|square|triangledown|triangleup|xcross)\\b", 631 | "captures": { 632 | "0": { 633 | "name": "variable.other.ps" 634 | }, 635 | "1": { 636 | "name": "variable.other.ps" 637 | }, 638 | "2": { 639 | "name": "invalid.illegal" 640 | } 641 | } 642 | }, 643 | { 644 | "match": "\\b(size)\\b(\\.)\\b(auto|huge|large|normal|small|tiny)\\b", 645 | "captures": { 646 | "0": { 647 | "name": "variable.other.ps" 648 | }, 649 | "1": { 650 | "name": "variable.other.ps" 651 | }, 652 | "2": { 653 | "name": "invalid.illegal" 654 | } 655 | } 656 | }, 657 | { 658 | "match": "\\b(splits)\\b(\\.)\\b(denominator|numerator)\\b", 659 | "captures": { 660 | "0": { 661 | "name": "variable.other.ps" 662 | }, 663 | "1": { 664 | "name": "variable.other.ps" 665 | }, 666 | "2": { 667 | "name": "invalid.illegal" 668 | } 669 | } 670 | }, 671 | { 672 | "match": "\\b(strategy)\\b(\\.)\\b(account_currency|cash|equity|eventrades|fixed|grossloss|grossprofit|initial_capital|long|losstrades|max_contracts_held_all|max_contracts_held_long|max_contracts_held_short|max_drawdown|netprofit|openprofit|percent_of_equity|position_avg_price|position_entry_name|position_size|short|wintrades)\\b", 673 | "captures": { 674 | "0": { 675 | "name": "variable.other.ps" 676 | }, 677 | "1": { 678 | "name": "variable.other.ps" 679 | }, 680 | "2": { 681 | "name": "invalid.illegal" 682 | } 683 | } 684 | }, 685 | { 686 | "match": "(strategy)(\\.)(commission)(\\.)(cash_per_contract|cash_per_order|percent)", 687 | "captures": { 688 | "0": { 689 | "name": "variable.other.ps" 690 | }, 691 | "1": { 692 | "name": "variable.other.ps" 693 | }, 694 | "2": { 695 | "name": "invalid.illegal" 696 | }, 697 | "3": { 698 | "name": "variable.other.ps" 699 | }, 700 | "4": { 701 | "name": "invalid.illegal" 702 | } 703 | } 704 | }, 705 | { 706 | "match": "(strategy)(\\.)(direction)(\\.)(all|long|short)", 707 | "captures": { 708 | "0": { 709 | "name": "variable.other.ps" 710 | }, 711 | "1": { 712 | "name": "variable.other.ps" 713 | }, 714 | "2": { 715 | "name": "invalid.illegal" 716 | }, 717 | "3": { 718 | "name": "variable.other.ps" 719 | }, 720 | "4": { 721 | "name": "invalid.illegal" 722 | } 723 | } 724 | }, 725 | { 726 | "match": "(strategy)(\\.)(oca)(\\.)(cancel|none|reduce)", 727 | "captures": { 728 | "0": { 729 | "name": "variable.other.ps" 730 | }, 731 | "1": { 732 | "name": "variable.other.ps" 733 | }, 734 | "2": { 735 | "name": "invalid.illegal" 736 | }, 737 | "3": { 738 | "name": "variable.other.ps" 739 | }, 740 | "4": { 741 | "name": "invalid.illegal" 742 | } 743 | } 744 | }, 745 | { 746 | "match": "\\b(syminfo)\\b(\\.)\\b(basecurrency|currency|description|mintick|pointvalue|prefix|root|session|ticker|tickerid|timezone|type)\\b", 747 | "captures": { 748 | "0": { 749 | "name": "variable.other.ps" 750 | }, 751 | "1": { 752 | "name": "variable.other.ps" 753 | }, 754 | "2": { 755 | "name": "invalid.illegal" 756 | } 757 | } 758 | }, 759 | { 760 | "match": "\\b(table)\\b(\\.)\\b(all)\\b", 761 | "captures": { 762 | "0": { 763 | "name": "variable.other.ps" 764 | }, 765 | "1": { 766 | "name": "variable.other.ps" 767 | }, 768 | "2": { 769 | "name": "invalid.illegal" 770 | } 771 | } 772 | }, 773 | { 774 | "match": "\\b(text)\\b(\\.)\\b(align_bottom|align_center|align_left|align_right|align_top)\\b", 775 | "captures": { 776 | "0": { 777 | "name": "variable.other.ps" 778 | }, 779 | "1": { 780 | "name": "variable.other.ps" 781 | }, 782 | "2": { 783 | "name": "invalid.illegal" 784 | } 785 | } 786 | }, 787 | { 788 | "match": "\\b(timeframe)\\b(\\.)\\b(isdaily|isdwm|isintraday|isminutes|ismonthly|isseconds|isweekly|multiplier|period)\\b", 789 | "captures": { 790 | "0": { 791 | "name": "variable.other.ps" 792 | }, 793 | "1": { 794 | "name": "variable.other.ps" 795 | }, 796 | "2": { 797 | "name": "invalid.illegal" 798 | } 799 | } 800 | }, 801 | { 802 | "match": "\\b(xloc)\\b(\\.)\\b(bar_index|bar_time)\\b", 803 | "captures": { 804 | "0": { 805 | "name": "variable.other.ps" 806 | }, 807 | "1": { 808 | "name": "variable.other.ps" 809 | }, 810 | "2": { 811 | "name": "invalid.illegal" 812 | } 813 | } 814 | }, 815 | { 816 | "match": "\\b(yloc)\\b(\\.)\\b(abovebar|belowbar|price)\\b", 817 | "captures": { 818 | "0": { 819 | "name": "variable.other.ps" 820 | }, 821 | "1": { 822 | "name": "variable.other.ps" 823 | }, 824 | "2": { 825 | "name": "invalid.illegal" 826 | } 827 | } 828 | }, 829 | { 830 | "match": "\\b(true|false)\\b", 831 | "name": "constant.numeric.ps" 832 | }, 833 | { 834 | "match": "\\b([0-9]+)\\b", 835 | "name": "constant.numeric.ps" 836 | }, 837 | { 838 | "match": "#[a-fA-F0-9]{6}", 839 | "name": "contstant.other.ps" 840 | } 841 | ] 842 | }, 843 | "functions": { 844 | "patterns": [ 845 | { 846 | "include": "#strings" 847 | }, 848 | { 849 | "include": "#constants" 850 | }, 851 | { 852 | "match": "\\b(indicator|library|strategy)+?(?=\\()", 853 | "name": "variable.parameter.function.language.special.self.python.ps" 854 | }, 855 | { 856 | "match": "(array)(\\.)(avg|clear|concat|copy|covariance|fill|from|get|includes|indexof|insert|join|lastindexof|max|median|min|mode|new_bool|new_box|new_color|new_float|new_int|new_label|new_line|new_string|new_table|pop|push|range|remove|reverse|set|shift|size|slice|sort|standardize|stdev|sum|unshift|variance)(?=\\()", 857 | "captures": { 858 | "0": { 859 | "name": "string.unquoted.asciidoc.ps" 860 | }, 861 | "1": { 862 | "name": "string.unquoted.asciidoc.ps" 863 | }, 864 | "2": { 865 | "name": "invalid.illegal" 866 | } 867 | } 868 | }, 869 | { 870 | "match": "(box)(\\.)(delete|get_bottom|get_left|get_right|get_top|new|set_bgcolor|set_border_color|set_border_style|set_border_width|set_bottom|set_extend|set_left|set_lefttop|set_right|set_rightbottom|set_top)(?=\\()", 871 | "captures": { 872 | "0": { 873 | "name": "string.unquoted.asciidoc.ps" 874 | }, 875 | "1": { 876 | "name": "string.unquoted.asciidoc.ps" 877 | }, 878 | "2": { 879 | "name": "invalid.illegal" 880 | } 881 | } 882 | }, 883 | { 884 | "match": "(color)(\\.)(rgb|b|from_gradient|g|new|r|t)(?=\\()", 885 | "captures": { 886 | "0": { 887 | "name": "string.unquoted.asciidoc.ps" 888 | }, 889 | "1": { 890 | "name": "string.unquoted.asciidoc.ps" 891 | }, 892 | "2": { 893 | "name": "invalid.illegal" 894 | } 895 | } 896 | }, 897 | { 898 | "match": "(input)(\\.)(bool|color|float|int|price|session|source|string|symbol|time|timeframe)(?=\\()", 899 | "captures": { 900 | "0": { 901 | "name": "string.unquoted.asciidoc.ps" 902 | }, 903 | "1": { 904 | "name": "string.unquoted.asciidoc.ps" 905 | }, 906 | "2": { 907 | "name": "invalid.illegal" 908 | } 909 | } 910 | }, 911 | { 912 | "match": "(label)(\\.)(delete|get_text|get_x|get_y|new|set_color|set_size|set_style|set_text|set_textalign|set_textcolor|set_tooltip|set_x|set_xloc|set_xy|set_y|set_yloc)(?=\\()", 913 | "captures": { 914 | "0": { 915 | "name": "string.unquoted.asciidoc.ps" 916 | }, 917 | "1": { 918 | "name": "string.unquoted.asciidoc.ps" 919 | }, 920 | "2": { 921 | "name": "invalid.illegal" 922 | } 923 | } 924 | }, 925 | { 926 | "match": "(line)(\\.)(delete|get_price|get_x1|get_x2|get_y1|get_y2|new|set_color|set_extend|set_style|set_width|set_x1|set_x2|set_xloc|set_xy1|set_xy2|set_y1|set_y2)(?=\\()", 927 | "captures": { 928 | "0": { 929 | "name": "string.unquoted.asciidoc.ps" 930 | }, 931 | "1": { 932 | "name": "string.unquoted.asciidoc.ps" 933 | }, 934 | "2": { 935 | "name": "invalid.illegal" 936 | } 937 | } 938 | }, 939 | { 940 | "match": "(math)(\\.)(abs|acos|asin|atan|avg|ceil|cos|exp|floor|log|log10|max|min|pow|random|round|round_to_mintick|sign|sin|sqrt|sum|tan|todegrees|toradians)(?=\\()", 941 | "captures": { 942 | "0": { 943 | "name": "string.unquoted.asciidoc.ps" 944 | }, 945 | "1": { 946 | "name": "string.unquoted.asciidoc.ps" 947 | }, 948 | "2": { 949 | "name": "invalid.illegal" 950 | } 951 | } 952 | }, 953 | { 954 | "match": "(ta)(\\.)(tr|alma|atr|barssince|bb|bbw|cci|change|cagr|cmo|cog|correlation|cross|crossover|crossunder|cum|dev|dmi|ema|falling|highest|highestbars|hma|kc|kcw|linreg|lowest|lowestbars|macd|median|mfi|mode|mom|percentile_linear_interpolation|percentile_nearest_rank|percentrank|pivothigh|pivotlow|range|rising|rma|roc|rsi|sar|sma|stdev|stoch|supertrend|swma|tsi|valuewhen|variance|vwap|vwma|wma|wpr)(?=\\()", 955 | "captures": { 956 | "0": { 957 | "name": "string.unquoted.asciidoc.ps" 958 | }, 959 | "1": { 960 | "name": "string.unquoted.asciidoc.ps" 961 | }, 962 | "2": { 963 | "name": "invalid.illegal" 964 | } 965 | } 966 | }, 967 | { 968 | "match": "(ta)(\\.)(wad|tr|vwap|obv|accdist|iii|nvi|pvi|pvt|wvad)", 969 | "captures": { 970 | "0": { 971 | "name": "variable.other.ps" 972 | }, 973 | "1": { 974 | "name": "variable.other.ps" 975 | }, 976 | "2": { 977 | "name": "invalid.illegal" 978 | } 979 | } 980 | }, 981 | { 982 | "match": "(request)(\\.)(dividends|earnings|financial|quandl|security|splits|error)(?=\\()", 983 | "captures": { 984 | "0": { 985 | "name": "string.unquoted.asciidoc.ps" 986 | }, 987 | "1": { 988 | "name": "string.unquoted.asciidoc.ps" 989 | }, 990 | "2": { 991 | "name": "invalid.illegal" 992 | } 993 | } 994 | }, 995 | { 996 | "match": "(strategy)(\\.)(closedtrades)(\\.)(commission|entry_bar_index|entry_price|entry_time|exit_bar_index|exit_price|exit_time|max_drawdown|max_runup|profit|size)(?=\\()", 997 | "captures": { 998 | "0": { 999 | "name": "string.unquoted.asciidoc.ps" 1000 | }, 1001 | "1": { 1002 | "name": "string.unquoted.asciidoc.ps" 1003 | }, 1004 | "2": { 1005 | "name": "invalid.illegal" 1006 | }, 1007 | "3": { 1008 | "name": "string.unquoted.asciidoc.ps" 1009 | }, 1010 | "4": { 1011 | "name": "invalid.illegal" 1012 | } 1013 | } 1014 | }, 1015 | { 1016 | "match": "(strategy)(\\.)(opentrades)(\\.)(commission|entry_bar_index|entry_price|entry_time|max_drawdown|max_runup|profit|size)(?=\\()", 1017 | "captures": { 1018 | "0": { 1019 | "name": "string.unquoted.asciidoc.ps" 1020 | }, 1021 | "1": { 1022 | "name": "string.unquoted.asciidoc.ps" 1023 | }, 1024 | "2": { 1025 | "name": "invalid.illegal" 1026 | }, 1027 | "3": { 1028 | "name": "string.unquoted.asciidoc.ps" 1029 | }, 1030 | "4": { 1031 | "name": "invalid.illegal" 1032 | } 1033 | } 1034 | }, 1035 | { 1036 | "match": "(strategy)(\\.)(risk)(\\.)(allow_entry_in|max_cons_loss_days|max_drawdown|max_intraday_filled_orders|max_intraday_loss|max_position_size)(?=\\()", 1037 | "captures": { 1038 | "0": { 1039 | "name": "string.unquoted.asciidoc.ps" 1040 | }, 1041 | "1": { 1042 | "name": "string.unquoted.asciidoc.ps" 1043 | }, 1044 | "2": { 1045 | "name": "invalid.illegal" 1046 | }, 1047 | "3": { 1048 | "name": "string.unquoted.asciidoc.ps" 1049 | }, 1050 | "4": { 1051 | "name": "invalid.illegal" 1052 | } 1053 | } 1054 | }, 1055 | { 1056 | "match": "(strategy)(\\.)(cancel|cancel_all|close|close_all|convert_to_account|convert_to_symbol|entry|exit|order|allow_entry_in|max_cons_loss_days|max_drawdown|max_intraday_filled_orders|max_intraday_loss|max_position_size)(?=\\()", 1057 | "captures": { 1058 | "0": { 1059 | "name": "string.unquoted.asciidoc.ps" 1060 | }, 1061 | "1": { 1062 | "name": "string.unquoted.asciidoc.ps" 1063 | }, 1064 | "2": { 1065 | "name": "invalid.illegal" 1066 | } 1067 | } 1068 | }, 1069 | { 1070 | "match": "(str)(\\.)(format|length|replace_all|split|tonumber|tostring)(?=\\()", 1071 | "captures": { 1072 | "0": { 1073 | "name": "string.unquoted.asciidoc.ps" 1074 | }, 1075 | "1": { 1076 | "name": "string.unquoted.asciidoc.ps" 1077 | }, 1078 | "2": { 1079 | "name": "invalid.illegal" 1080 | } 1081 | } 1082 | }, 1083 | { 1084 | "match": "(table)(\\.)(cell|cell_set_bgcolor|cell_set_height|cell_set_text|cell_set_text_color|cell_set_text_halign|cell_set_text_size|cell_set_text_valign|cell_set_width|clear|delete|new|set_bgcolor|set_border_color|set_border_width|set_frame_color|set_frame_width|set_position)(?=\\()", 1085 | "captures": { 1086 | "0": { 1087 | "name": "string.unquoted.asciidoc.ps" 1088 | }, 1089 | "1": { 1090 | "name": "string.unquoted.asciidoc.ps" 1091 | }, 1092 | "2": { 1093 | "name": "invalid.illegal" 1094 | } 1095 | } 1096 | }, 1097 | { 1098 | "match": "(ticker)(\\.)(heikinashi|kagi|linebreak|modify|new|pointfigure|renko)(?=\\()", 1099 | "captures": { 1100 | "0": { 1101 | "name": "string.unquoted.asciidoc.ps" 1102 | }, 1103 | "1": { 1104 | "name": "string.unquoted.asciidoc.ps" 1105 | }, 1106 | "2": { 1107 | "name": "invalid.illegal" 1108 | } 1109 | } 1110 | }, 1111 | { 1112 | "match": "(runtime)(\\.)(error)(?=\\()", 1113 | "captures": { 1114 | "0": { 1115 | "name": "string.unquoted.asciidoc.ps" 1116 | }, 1117 | "1": { 1118 | "name": "string.unquoted.asciidoc.ps" 1119 | }, 1120 | "2": { 1121 | "name": "invalid.illegal" 1122 | } 1123 | } 1124 | }, 1125 | { 1126 | "match": "\\b(abovebar|belowbar|bar_index|close|high|hl2|hlc3|low|ohlc4|open|timenow|time_tradingday|volume)\\b", 1127 | "name": "variable.other.ps" 1128 | }, 1129 | { 1130 | "match": "\\b(alert|alertcondition|barcolor|bgcolor|bool|box|color|dayofmonth|dayofweek|fill|fixnan|float|hline|hour|input|int|label|line|max_bars_back|minute|month|na|nz|plot|plotarrow|plotbar|plotcandle|plotchar|plotshape|second|string|table|time|time_close|timestamp|weekofyear|year)(?=\\()", 1131 | "name": "string.unquoted.asciidoc.ps" 1132 | }, 1133 | { 1134 | "match": "(\\w+)(\\.)(\\w+)\\(", 1135 | "captures": { 1136 | "0": { 1137 | "name": "invalid.illegal.ps" 1138 | }, 1139 | "1": { 1140 | "name": "storage.type.cs.ps" 1141 | }, 1142 | "2": { 1143 | "name": "invalid.illegal.ps" 1144 | }, 1145 | "3": { 1146 | "name": "token.error-token.ps" 1147 | } 1148 | } 1149 | }, 1150 | { 1151 | "match": "(?!=export)(\\s)(\\w+*)\\s(?=\\()", 1152 | "captures": { 1153 | "0": { 1154 | "name": "token.error-token.ps" 1155 | } 1156 | } 1157 | }, 1158 | { 1159 | "match": "(\\w+*)\\(", 1160 | "captures": { 1161 | "0": { 1162 | "name": "invalid.illegal.ps" 1163 | }, 1164 | "1": { 1165 | "name": "token.error-token.ps" 1166 | } 1167 | } 1168 | }, 1169 | { 1170 | "match": "(=>)", 1171 | "name": "invalid.illegal.non-null-typehinted.php.ps" 1172 | }, 1173 | { 1174 | "match": "(\\))\\s*(=>)\\s*", 1175 | "captures": { 1176 | "0": { 1177 | "name": "invalid.illegal.non-null-typehinted.php.ps" 1178 | }, 1179 | "1": { 1180 | "name": "invalid.illegal.ps" 1181 | } 1182 | } 1183 | }, 1184 | { 1185 | "match": "\\b(strategy.opentrades)\\b", 1186 | "name": "variable.other.ps" 1187 | }, 1188 | { 1189 | "match": "\\b(strategy.closedtrades)\\b", 1190 | "name": "variable.other.ps" 1191 | }, 1192 | { 1193 | "match": "\\b(dayofmonth|dayofweek|second|hour|minute|month|na|time|time_close|weekofyear|year)\\b", 1194 | "name": "variable.other.ps" 1195 | }, 1196 | { 1197 | "match": "(math)(\\.)(e|phi|pi|rphi)", 1198 | "captures": { 1199 | "0": { 1200 | "name": "variable.other.ps" 1201 | }, 1202 | "1": { 1203 | "name": "variable.other.ps" 1204 | }, 1205 | "2": { 1206 | "name": "invalid.illegal" 1207 | } 1208 | } 1209 | } 1210 | ] 1211 | }, 1212 | "keywords": { 1213 | "patterns": [ 1214 | { 1215 | "match": "\\b(box|by|if|in|else|elseif|line|table|continue|break|for|return|var|varip|not|while|switch|series)\\b", 1216 | "name": "keyword.operator.logical.js.ps" 1217 | } 1218 | ] 1219 | }, 1220 | "variables": { 1221 | "patterns": [ 1222 | { 1223 | "match": "[a-zA-Z_][a-zA-Z0-9_]*\\s*(?=\\=|:=)", 1224 | "name": "punctuation.separator.parameters.ps" 1225 | } 1226 | ] 1227 | }, 1228 | "operators": { 1229 | "patterns": [ 1230 | { 1231 | "match": "(\\-\\=|\\+\\=|\\*\\=|/=|%=)", 1232 | "name": "punctuation.section.embedded.begin.ps" 1233 | }, 1234 | { 1235 | "match": "(\\-|\\+|\\*|/|%)", 1236 | "name": "punctuation.section.embedded.begin.ps" 1237 | }, 1238 | { 1239 | "match": "(={2}|!=|<=|>=|<|>|:=)", 1240 | "name": "punctuation.section.embedded.begin.ps" 1241 | }, 1242 | { 1243 | "match": "(\\?|\\:)", 1244 | "name": "keyword.operator.ternary.ps" 1245 | }, 1246 | { 1247 | "match": "\\b(and|or|not|bool|float|int|string|color|table|simple)\\b", 1248 | "name": "keyword.operator.logical.js.ps" 1249 | }, 1250 | { 1251 | "match": "\\.", 1252 | "name": "invalid.illegal.java" 1253 | }, 1254 | { 1255 | "match": "\\(", 1256 | "name": "invalid.illegal.ps" 1257 | }, 1258 | { 1259 | "match": "\\)", 1260 | "name": "invalid.illegal.ps" 1261 | }, 1262 | { 1263 | "match": "\\,", 1264 | "name": "invalid.illegal.ps" 1265 | }, 1266 | { 1267 | "match": "=", 1268 | "name": "keyword.operator.arithmetic.ps" 1269 | }, 1270 | { 1271 | "match": "[a-zA-Z_][a-zA-Z0-9_]*", 1272 | "name": "punctuation.separator.parameters.ps" 1273 | } 1274 | ] 1275 | } 1276 | }, 1277 | "scopeName": "source.ps" 1278 | } --------------------------------------------------------------------------------