├── .gitattributes ├── .gitignore ├── .vscode ├── launch.json └── settings.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example.pine ├── images ├── pine_example.png └── pinetreeicon.png ├── language-configuration.json ├── package.json ├── syntaxes └── pine.tmLanguage.json └── test.pine /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "runtimeExecutable": "${execPath}", 13 | "args": [ 14 | "--extensionDevelopmentPath=${workspaceFolder}" 15 | ] 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "abovebar", 4 | "accdist", 5 | "alertcondition", 6 | "areabr", 7 | "arrowdown", 8 | "arrowup", 9 | "barmerge", 10 | "barsince", 11 | "barstate", 12 | "basecurrency", 13 | "belowbar", 14 | "bgcolor", 15 | "builtins", 16 | "closedtrades", 17 | "crossunder", 18 | "dayofmonth", 19 | "dayofweek", 20 | "eventrades", 21 | "grossloss", 22 | "grossprofit", 23 | "heikinashi", 24 | "highestbars", 25 | "hline", 26 | "indexof", 27 | "intraday", 28 | "isconfirmed", 29 | "isdaily", 30 | "isdwm", 31 | "isfirst", 32 | "ishistory", 33 | "isintraday", 34 | "islast", 35 | "isminutes", 36 | "ismonthly", 37 | "isnew", 38 | "isrealtime", 39 | "isseconds", 40 | "isweekly", 41 | "kagi", 42 | "labeldown", 43 | "labelup", 44 | "lastindexof", 45 | "linebr", 46 | "linebreak", 47 | "linreg", 48 | "losstrades", 49 | "lowestbars", 50 | "macd", 51 | "mintick", 52 | "netprofit", 53 | "ntrades", 54 | "ohlc", 55 | "openprofit", 56 | "opentrades", 57 | "pe", 58 | "percentrank", 59 | "pinetreeicon", 60 | "pivothigh", 61 | "pivotlow", 62 | "pointfigure", 63 | "pointvalue", 64 | "quandl", 65 | "readwrite", 66 | "renko", 67 | "stdev", 68 | "stepline", 69 | "stoch", 70 | "supertrend", 71 | "swma", 72 | "syminfo", 73 | "textalign", 74 | "textcolor", 75 | "tickerid", 76 | "timeframe", 77 | "timenow", 78 | "todegrees", 79 | "tonumber", 80 | "toradians", 81 | "tostring", 82 | "triangledown", 83 | "triangleup", 84 | "valuewhen", 85 | "vwap", 86 | "vwma", 87 | "weekofyear", 88 | "wintrades", 89 | "wvad", 90 | "xcross", 91 | "xloc", 92 | "yloc" 93 | ] 94 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [0.1.4] - 2020-11-01 4 | - Add Pine 4 syntax (Thanks @Jos512) 5 | 6 | ## [0.1.3] - 2018-09-11 7 | - Add pine tree from FontAwesome as icon for VS code 8 | 9 | ## [0.1.2] - 2018-09-10 10 | - Missing example image 11 | 12 | ## [0.1.0] - 2018-09-10 13 | - Initial release 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | pine-script-syntax-highlighting 2 | 3 | MIT License 4 | 5 | Copyright (c) 2018 Leif Ringstad 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Archived 2 | 3 | Project is no longer maintained. 4 | 5 | # Pine script syntax highlighting for VS Code 6 | 7 | ![Pinetree](images/pinetreeicon.png) 8 | 9 | ## Features 10 | 11 | This extension adds Pine Script Syntax Hightlighting for VS Code. Intended for Pine Script coders so it's easier to use the Visual Studio Code IDE to help write Pine Script. 12 | 13 | Usage: Install in VSC this extension. Then files with `.pine` extension will get syntax highlighting. See `example.pine` to test... 14 | 15 | ![Pine Example](images/pine_example.png) 16 | 17 | ## Pull requests 18 | 19 | If you find the syntax highlighting to be inadequate, please submit a PR. 20 | 21 | #### Share 22 | 23 | Do share good strategies or inidcators. 24 | 25 | 26 | Note: This extension is provided as-is. It doesn't do tricks for your trading. Only colors what you write... 27 | 28 | Thanks to @Jos512 for the Pine4 updates 29 | -------------------------------------------------------------------------------- /example.pine: -------------------------------------------------------------------------------- 1 | // This is a comment 2 | // Small Pine example to test syntax highlighting 3 | 4 | study("MACD") 5 | fast = 12, slow = 26 6 | fastMA = ema(close, fast) 7 | slowMA = ema(close, slow) 8 | macd = fastMA - slowMA 9 | signal = sma(macd, 9) 10 | plot(macd, color=blue) 11 | plot(signal, color=orange) 12 | n1 = input(90, "Setting 1") 13 | n2 = input(6, "Setting 2") 14 | 15 | testfunction(src) => ema(n1, n2) 16 | -------------------------------------------------------------------------------- /images/pine_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leifcr/pine-script-syntax-highlighting/34a2800bc68336b57cb614ddcb149169380493ed/images/pine_example.png -------------------------------------------------------------------------------- /images/pinetreeicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leifcr/pine-script-syntax-highlighting/34a2800bc68336b57cb614ddcb149169380493ed/images/pinetreeicon.png -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["[", "]"], 17 | ["(", ")"], 18 | ["\"", "\""], 19 | ["'", "'"] 20 | ], 21 | // symbols that that can be used to surround a selection 22 | "surroundingPairs": [ 23 | ["[", "]"], 24 | ["(", ")"], 25 | ["\"", "\""], 26 | ["'", "'"] 27 | ] 28 | // "wordPattern": [], 29 | 30 | // "indentationRules": { 31 | // "increaseIndentPattern": "^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|(\"|'|\/).*\\4)*(#.*)?$", 32 | // "decreaseIndentPattern": "^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when)\\b)" 33 | // } 34 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pine-script-syntax-highlighting", 3 | "displayName": "Pine Script Syntax Highlighting", 4 | "description": "Syntax Highlighting for Pine Script", 5 | "version": "0.1.5", 6 | "publisher": "leifcr", 7 | "license": "MIT", 8 | "engines": { 9 | "vscode": "^1.27.0" 10 | }, 11 | "categories": [ 12 | "Programming Languages" 13 | ], 14 | "contributes": { 15 | "languages": [ 16 | { 17 | "id": "pine", 18 | "aliases": [ 19 | "Pine Script", 20 | "pine" 21 | ], 22 | "extensions": [ 23 | ".pine" 24 | ], 25 | "configuration": "./language-configuration.json" 26 | } 27 | ], 28 | "grammars": [ 29 | { 30 | "language": "pine", 31 | "scopeName": "source.pine", 32 | "path": "./syntaxes/pine.tmLanguage.json" 33 | } 34 | ] 35 | }, 36 | "icon": "images/pinetreeicon.png", 37 | "repository": { 38 | "type": "git", 39 | "url": "https://github.com/leifcr/pine-script-syntax-highlighting.git" 40 | }, 41 | "bugs": { 42 | "url": "https://github.com/leifcr/pine-script-syntax-highlighting/issues" 43 | } 44 | } -------------------------------------------------------------------------------- /syntaxes/pine.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.pine" 8 | }, 9 | { 10 | "include": "#string" 11 | }, 12 | { 13 | "include": "#constants" 14 | }, 15 | { 16 | "include": "#builtins" 17 | }, 18 | { 19 | "include": "#functionCall" 20 | }, 21 | { 22 | "include": "#functions" 23 | }, 24 | { 25 | "include": "#variables" 26 | }, 27 | { 28 | "include": "#operators" 29 | }, 30 | { 31 | "include": "#keywords" 32 | }, 33 | { 34 | "include": "#imports" 35 | }, 36 | { 37 | "include": "#invalid" 38 | } 39 | ], 40 | "repository": { 41 | "string": { 42 | "patterns": [ 43 | { 44 | "begin": "\"", 45 | "beginCaptures": { 46 | "1": { 47 | "name": "punctuation.definition.string.begin.pine" 48 | } 49 | }, 50 | "end": "\"", 51 | "endCaptures": { 52 | "1": { 53 | "name": "punctuation.definition.string.end.pine" 54 | } 55 | }, 56 | "name": "string.quoted.double.pine", 57 | "patterns": [ 58 | { 59 | "match": "\\\\.", 60 | "name": "constant.character.escaped.pine" 61 | } 62 | ] 63 | }, 64 | { 65 | "begin": "'", 66 | "beginCaptures": { 67 | "1": { 68 | "name": "punctuation.definition.string.begin.pine" 69 | } 70 | }, 71 | "end": "'", 72 | "endCaptures": { 73 | "1": { 74 | "name": "punctuation.definition.string.end.pine" 75 | } 76 | }, 77 | "name": "string.quoted.double.pine", 78 | "patterns": [ 79 | { 80 | "match": "\\\\.", 81 | "name": "constant.character.escaped.pine" 82 | } 83 | ] 84 | } 85 | ] 86 | }, 87 | "boolean": { 88 | "patterns": [ 89 | { 90 | "name": "constant.language.boolean.true.pine", 91 | "match": "\\btrue\\b" 92 | }, 93 | { 94 | "name": "constant.language.boolean.false.pine", 95 | "match": "\\bfalse\\b" 96 | } 97 | ] 98 | }, 99 | "number": { 100 | "patterns": [ 101 | { 102 | "name": "constant.numeric.decimal.pine", 103 | "match": "\\b(?:\\d+(?:\\.\\d+)?)\\b" 104 | }, 105 | { 106 | "name": "constant.numeric.integer.pine", 107 | "match": "\\b\\d+\\b" 108 | } 109 | ] 110 | }, 111 | "literals": { 112 | "patterns": [ 113 | { 114 | "include": "#string" 115 | }, 116 | { 117 | "include": "#boolean" 118 | }, 119 | { 120 | "include": "#number" 121 | } 122 | ] 123 | }, 124 | "paramSeparator": { 125 | "name": "punctuation.separator.parameter.pine", 126 | "match": "," 127 | }, 128 | "functionParam": { 129 | "patterns": [ 130 | { 131 | "name": "variable.parameter.pine", 132 | "begin": "(?<=(?:\\(\\s*|,\\s*|^\\s+))(((?:(?:simple|series)\\s+)?((int|float|string|bool)(?:\\[\\])?|(array|label|line|color)))(?:\\s+))?(\\w+)\\s*(=)\\s*", 133 | "beginCaptures": { 134 | "2": { 135 | "name": "meta.type.annotation.pine" 136 | }, 137 | "4": { 138 | "name": "support.type.primitive.pine" 139 | }, 140 | "5": { 141 | "name": "support.type.builtin.pine" 142 | }, 143 | "6": { 144 | "name": "meta.definition.variable.name.pine" 145 | }, 146 | "7": { 147 | "name": "keyword.operator.assignment.pine" 148 | } 149 | }, 150 | "patterns": [ 151 | { 152 | "include": "#literals" 153 | }, 154 | { 155 | "include": "#constants" 156 | }, 157 | { 158 | "include": "#paramSeparator" 159 | } 160 | ], 161 | "end": "(?=\\s*(?:$|,|\\)))" 162 | }, 163 | { 164 | "name": "variable.parameter.pine", 165 | "match": "(?<=(?:\\(\\s*|,\\s*|^\\s+))(((?:(?:simple|series)\\s+)?((int|float|string|bool)(?:\\[\\])?|(array|label|line|color)))(?:\\s+))?(\\w+)(?=\\s*(?:$|,|\\)))", 166 | "captures": { 167 | "2": { 168 | "name": "meta.type.annotation.pine" 169 | }, 170 | "4": { 171 | "name": "support.type.primitive.pine" 172 | }, 173 | "5": { 174 | "name": "support.type.builtin.pine" 175 | }, 176 | "6": { 177 | "name": "meta.definition.variable.name.pine" 178 | } 179 | } 180 | } 181 | ] 182 | }, 183 | "exportedFunctionParam": { 184 | "patterns": [ 185 | { 186 | "name": "variable.parameter.pine", 187 | "begin": "(?<=(?:\\(\\s*|,\\s*|^\\s+))(((?:(?:simple|series)\\s+)?((int|float|string|bool)(?:\\[\\])?|(array|label|line|color)))(?:\\s+))(\\w+)\\s*(=)\\s*", 188 | "beginCaptures": { 189 | "2": { 190 | "name": "meta.type.annotation.pine" 191 | }, 192 | "4": { 193 | "name": "support.type.primitive.pine" 194 | }, 195 | "5": { 196 | "name": "support.type.builtin.pine" 197 | }, 198 | "6": { 199 | "name": "meta.definition.variable.name.pine" 200 | }, 201 | "7": { 202 | "name": "keyword.operator.assignment.pine" 203 | } 204 | }, 205 | "patterns": [ 206 | { 207 | "include": "#literals" 208 | }, 209 | { 210 | "include": "#constants" 211 | }, 212 | { 213 | "include": "#paramSeparator" 214 | } 215 | ], 216 | "end": "(?=\\s*(?:$|,|\\)))" 217 | }, 218 | { 219 | "name": "variable.parameter.pine", 220 | "match": "(?<=(?:\\(\\s*|,\\s*|^\\s+))(((?:(?:simple|series)\\s+)?((int|float|string|bool)(?:\\[\\])?|(array|label|line|color)))(?:\\s+))(\\w+)(?=\\s*(?:$|,|\\)))", 221 | "captures": { 222 | "2": { 223 | "name": "meta.type.annotation.pine" 224 | }, 225 | "4": { 226 | "name": "support.type.primitive.pine" 227 | }, 228 | "5": { 229 | "name": "support.type.builtin.pine" 230 | }, 231 | "6": { 232 | "name": "meta.definition.variable.name.pine" 233 | } 234 | } 235 | }, 236 | { 237 | "name": "invalid.variable.parameter.pine", 238 | "match": "(?<=(?:\\(|,|^)\\s*)(\\w+)(?=\\s*(?:$|,|\\)))" 239 | } 240 | ] 241 | }, 242 | "functionCallParam": { 243 | "patterns": [ 244 | { 245 | "include": "#literals" 246 | }, 247 | { 248 | "include": "#constants" 249 | }, 250 | { 251 | "include": "#builtins" 252 | }, 253 | { 254 | "include": "#operators" 255 | }, 256 | { 257 | "include": "#functionCall" 258 | }, 259 | { 260 | "match": "(?<=\\s+|\\(\\s*|,\\s*)(\\w+)(?=\\s*=)", 261 | "captures": { 262 | "1" : { 263 | "name":"entity.name.variable.parameter" 264 | } 265 | } 266 | }, 267 | { 268 | "name": "variable.other.readwrite.pine", 269 | "match": "\\w+" 270 | } 271 | ] 272 | }, 273 | "exportedFunctionParams": { 274 | "name": "meta.parameters.pine", 275 | "begin": "\\(", 276 | "beginCaptures": { 277 | "0": { 278 | "name": "punctuation.definition.parameters.begin.pine" 279 | } 280 | }, 281 | "end": "\\)", 282 | "endCaptures": { 283 | "0": { 284 | "name": "punctuation.definition.parameters.end.pine" 285 | } 286 | }, 287 | "patterns": [ 288 | { 289 | "include": "#exportedFunctionParam" 290 | }, 291 | { 292 | "include": "#paramSeparator" 293 | } 294 | ] 295 | }, 296 | "functionParams": { 297 | "name": "meta.parameters.pine", 298 | "begin": "\\(", 299 | "beginCaptures": { 300 | "0": { 301 | "name": "punctuation.definition.parameters.begin.pine" 302 | } 303 | }, 304 | "end": "\\)", 305 | "endCaptures": { 306 | "0": { 307 | "name": "punctuation.definition.parameters.end.pine" 308 | } 309 | }, 310 | "patterns": [ 311 | { 312 | "include": "#functionParam" 313 | }, 314 | { 315 | "include": "#paramSeparator" 316 | } 317 | ] 318 | }, 319 | "functionCallParams": { 320 | "begin": "\\(", 321 | "beginCaptures": { 322 | "0": { 323 | "name": "meta.brace.round.open.pine" 324 | } 325 | }, 326 | "end": "\\)", 327 | "endCaptures": { 328 | "0": { 329 | "name": "meta.brace.round.pine.close.pine" 330 | } 331 | }, 332 | "patterns": [ 333 | { 334 | "include": "#functionParam" 335 | }, 336 | { 337 | "include": "#functionCallParam" 338 | }, 339 | { 340 | "include": "#paramSeparator" 341 | } 342 | ] 343 | }, 344 | "variables": { 345 | "patterns": [ 346 | { 347 | "match": "^\\s*(var)\\s+([a-zA-Z]\\w*)\\s*([+-:])?(=(?!>))?", 348 | "captures": { 349 | "1":{ 350 | "name": "storage.type.pine" 351 | }, 352 | "2": { 353 | "name": "variable.other.readwrite.pine" 354 | }, 355 | "3": { 356 | "name": "invalid.pine" 357 | }, 358 | "4": { 359 | "name": "keyword.operator.assignment.pine" 360 | } 361 | } 362 | }, 363 | { 364 | "name": "meta.var.expr.pine", 365 | "match": "^\\s*((var)\\s+)?((int|float|string|bool)(?:\\[\\])?\\s+)?([a-zA-Z]\\w*)\\s+(=(?!>))", 366 | "captures": { 367 | "2": { 368 | "name": "storage.type.pine" 369 | }, 370 | "4": { 371 | "name": "support.type.primitive.pine" 372 | }, 373 | "5": { 374 | "name": "variable.other.readwrite.pine" 375 | }, 376 | "6": { 377 | "name": "keyword.operator.assignment" 378 | } 379 | } 380 | }, 381 | { 382 | "name": "meta.var.expr.pine", 383 | "match": "^\\s*((var)\\s+)?((array|label|line|color)\\s+)([a-zA-Z]\\w*)\\s+([+-:])?(=(?!>))", 384 | "captures": { 385 | "2": { 386 | "name": "storage.type.pine" 387 | }, 388 | "4": { 389 | "name": "support.type.builtin.pine" 390 | }, 391 | "5": { 392 | "name": "variable.other.readwrite.pine" 393 | }, 394 | "6": { 395 | "name": "invalid.pine" 396 | }, 397 | "7": { 398 | "name": "keyword.operator.assignment" 399 | } 400 | } 401 | }, 402 | { 403 | "name": "meta.var.expr.pine", 404 | "match": "^\\s*((var)\\s+)?(int|float|string|bool)(?:\\[\\])?\\b(\\s+([a-zA-Z]\\w*))?", 405 | "captures": { 406 | "2": { 407 | "name": "storage.type.pine" 408 | }, 409 | "3": { 410 | "name": "support.type.primitive.pine" 411 | }, 412 | "5": { 413 | "name": "variable.other.readwrite.pine" 414 | } 415 | } 416 | }, 417 | { 418 | "name": "meta.var.expr.pine", 419 | "match": "^\\s*((var)\\s+)?(array|label|line|color)\\b(?!\\.)(\\s+([a-zA-Z]\\w*))?", 420 | "captures": { 421 | "2": { 422 | "name": "storage.type.pine" 423 | }, 424 | "3": { 425 | "name": "support.type.builtin.pine" 426 | }, 427 | "5": { 428 | "name": "variable.other.readwrite.pine" 429 | } 430 | } 431 | }, 432 | { 433 | "name": "storage.type.pine", 434 | "match": "^\\s*((var)\\b)" 435 | }, 436 | { 437 | "match": "^\\s*([a-zA-Z]\\w*)\\s*([+-:]=)", 438 | "captures": { 439 | "1": { 440 | "name": "variable.other.readwrite.pine" 441 | }, 442 | "2": { 443 | "name": "keyword.operator.assignment.pine" 444 | } 445 | } 446 | } 447 | ] 448 | }, 449 | "imports": { 450 | "patterns": [ 451 | { 452 | "name": "meta.import.pine", 453 | "match": "^(import)\\s+([^/]+/[^/]+/\\d+)(\\s+(as)\\s+(\\w+))?\\s*$", 454 | "captures": { 455 | "1": { 456 | "name": "keyword.control.pine" 457 | }, 458 | "2": { 459 | "name": "expr.import.pine" 460 | }, 461 | "4": { 462 | "name": "keyword.control.pine" 463 | }, 464 | "5": { 465 | "name": "variable.other.readwrite.alias.pine" 466 | } 467 | } 468 | } 469 | ] 470 | }, 471 | "functionCall": { 472 | "patterns": [ 473 | { 474 | "name": "meta.function-call.pine", 475 | "begin": "(?<=(?:^|=|(?:if|switch|while|return)\\s)\\s*(?:\\bnot\\s+)?(?:\\w+\\.)?)(\\w+)(?=\\()", 476 | "beginCaptures": { 477 | "1": { "name": "entity.name.function" } 478 | }, 479 | "end": "(?<=\\))", 480 | "patterns": [ 481 | { "include": "#functionCallParams" } 482 | ] 483 | } 484 | ] 485 | }, 486 | "functions": { 487 | "patterns": [ 488 | { 489 | "name": "meta.definition.function.pine", 490 | "begin": "^(export)\\s+(\\w+)(?=\\()", 491 | "beginCaptures": { 492 | "1": { "name": "keyword.control.export.pine" }, 493 | "2": { "name": "entity.name.function" } 494 | }, 495 | "end": "(?<=\\))\\s*(=>)", 496 | "endCaptures": { 497 | "1": { "name": "storage.type.function.arrow.pine" } 498 | }, 499 | "patterns": [ 500 | { 501 | "include": "#exportedFunctionParams" 502 | } 503 | ] 504 | }, 505 | { 506 | "name": "meta.definition.function.pine", 507 | "begin": "^(\\w+)(?=\\()", 508 | "beginCaptures": { 509 | "1": { "name": "entity.name.function" } 510 | }, 511 | "end": "(?<=\\))\\s*(=>)", 512 | "endCaptures": { 513 | "1": { "name": "storage.type.function.arrow.pine" } 514 | }, 515 | "patterns": [ 516 | { 517 | "include": "#functionParams" 518 | } 519 | ] 520 | } 521 | ] 522 | }, 523 | "builtins":{ 524 | "patterns": [ 525 | { 526 | "name": "meta.function-call", 527 | "begin": "\\b(ta)(\\.)((alma|atr|bb|bbw|cci|cmo|cog|dmi|ema|hma|kc|kcw|linreg|macd|mfi|mom|rma|roc|rsi|sar|sma|stoch|supertrend|swma|tr|tsi|vwap|vwma|wma|wpr|barsince|change|correlation|cross|crossover|crossunder|cum|dev|falling|highest|highestbars|lowest|lowestbars|median|mode|percentile_linear_interpolation|percentile_nearest_rank|percentrank|pivothigh|pivotlow|range|rising|stdev|valuewhen|variance)|(\\w+))(?=\\()", 528 | "beginCaptures": { 529 | "1" : { "name" : "constant.language.pine" }, 530 | "2" : { "name" : "punctuation.accessor.pine" }, 531 | "4" : { "name" : "support.function.ta.pine" }, 532 | "5" : { "name" : "invalid.function.ta.pine" } 533 | }, 534 | "end":"(?<=\\))", 535 | "patterns": [ 536 | { "include": "#functionCallParams" } 537 | ] 538 | }, 539 | { 540 | "match": "\\b(ta)(\\.)(accdist|iii|nvi|obv|pvi|pvt|tr|vwap|wad|wvad)\\b", 541 | "captures": { 542 | "1" : { "name" : "constant.language.pine" }, 543 | "2" : { "name" : "punctuation.accessor.pine" }, 544 | "3" : { "name" : "constant.language.pine" } 545 | } 546 | }, 547 | { 548 | "name": "constant.language.pine", 549 | "match": "\\b(ta)\\b" 550 | }, 551 | { 552 | "name": "meta.function-call", 553 | "begin": "\\b(math)(\\.)((abs|acos|cos|asin|sin|atan|tan|ceil|floor|exp|log|log10|round_to_mintick|sign|sqrt|avg|max|min|pow|random|round|sum|todegrees|toradians)|(\\w+))(?=\\()", 554 | "beginCaptures": { 555 | "1" : { "name" : "constant.language.pine" }, 556 | "2" : { "name" : "punctuation.accessor.pine" }, 557 | "4" : { "name" : "support.function.math.pine" }, 558 | "5" : { "name" : "invalid.function.math.pine" } 559 | }, 560 | "end":"(?<=\\))", 561 | "patterns": [ 562 | { "include": "#functionCallParams" } 563 | ] 564 | }, 565 | { 566 | "name": "constant.language.pine", 567 | "match": "\\b(math)\\b" 568 | }, 569 | { 570 | "name": "meta.function-call", 571 | "begin": "\\b(str)(\\.)((tostring|tonumber)|(\\w+))(?=\\()", 572 | "beginCaptures": { 573 | "1" : { "name" : "constant.language.pine" }, 574 | "2" : { "name" : "punctuation.accessor.pine" }, 575 | "4" : { "name" : "support.function.str.pine" }, 576 | "5" : { "name" : "invalid.function.str.pine" } 577 | }, 578 | "end":"(?<=\\))", 579 | "patterns": [ 580 | { "include": "#functionCallParams" } 581 | ] 582 | }, 583 | { 584 | "name": "constant.language.pine", 585 | "match": "\\b(str)\\b" 586 | }, 587 | { 588 | "name": "meta.function-call", 589 | "begin": "\\b(ticker)(\\.)((heikinashi|kagi|linebreak|pointfigure|renko|new)|(\\w+))(?=\\()", 590 | "beginCaptures": { 591 | "1" : { "name" : "constant.language.pine" }, 592 | "2" : { "name" : "punctuation.accessor.pine" }, 593 | "4" : { "name" : "support.function.ticker.pine" }, 594 | "5" : { "name" : "invalid.function.ticker.pine" } 595 | }, 596 | "end":"(?<=\\))", 597 | "patterns": [ 598 | { "include": "#functionCallParams" } 599 | ] 600 | }, 601 | { 602 | "name": "constant.language.pine", 603 | "match": "\\b(ticker)\\b" 604 | }, 605 | { 606 | "name": "meta.function-call", 607 | "begin": "\\b(request)(\\.)((financial|quandl|security|splits|dividends|earnings)|(\\w+))(?=\\()", 608 | "beginCaptures": { 609 | "1" : { "name" : "constant.language.pine" }, 610 | "2" : { "name" : "punctuation.accessor.pine" }, 611 | "4" : { "name" : "support.function.request.pine" }, 612 | "5" : { "name" : "invalid.function.request.pine" } 613 | }, 614 | "end":"(?<=\\))", 615 | "patterns": [ 616 | { "include": "#functionCallParams" } 617 | ] 618 | }, 619 | { 620 | "name": "constant.language.pine", 621 | "match": "\\b(request)\\b" 622 | }, 623 | { 624 | "name": "meta.function-call", 625 | "begin": "\\b(input)(\\.)((bool|int|float|string|color|timeframe|session|source|symbol|time)|(\\w+))(?=\\()", 626 | "beginCaptures": { 627 | "1" : { "name" : "constant.language.pine" }, 628 | "2" : { "name" : "punctuation.accessor.pine" }, 629 | "4" : { "name" : "support.function.input.pine" }, 630 | "5" : { "name" : "invalid.function.input.pine" } 631 | }, 632 | "end":"(?<=\\))", 633 | "patterns": [ 634 | { "include": "#functionCallParams" } 635 | ] 636 | }, 637 | { 638 | "name": "constant.language.pine", 639 | "match": "\\b(input)\\b" 640 | }, 641 | { 642 | "name": "meta.function-call", 643 | "begin": "\\b(strategy)(\\.)(risk)(\\.)((allow_entry_in|max_cons_loss_days|max_drawdown|max_intraday_filled_orders|max_intraday_loss|max_position_size)|(\\w+))(?=\\()", 644 | "beginCaptures": { 645 | "1" : { "name" : "constant.language.pine" }, 646 | "2" : { "name" : "punctuation.accessor.pine" }, 647 | "3" : { "name" : "constant.language.pine" }, 648 | "4" : { "name" : "punctuation.accessor.pine" }, 649 | "6" : { "name" : "support.function.strategy.risk.pine" }, 650 | "7" : { "name" : "invalid.function.strategy.risk.pine" } 651 | }, 652 | "end":"(?<=\\))", 653 | "patterns": [ 654 | { "include": "#functionCallParams" } 655 | ] 656 | }, 657 | { 658 | "name": "meta.function-call", 659 | "begin": "\\b(strategy)(\\.)((cancel|cancel_all|close|close_all|entry|exit|order)|(\\w+))(?=\\()", 660 | "beginCaptures": { 661 | "1" : { "name" : "constant.language.pine" }, 662 | "2" : { "name" : "punctuation.accessor.pine" }, 663 | "4" : { "name" : "support.function.strategy.pine" }, 664 | "5" : { "name" : "invalid.function.strategy.pine" } 665 | }, 666 | "end":"(?<=\\))", 667 | "patterns": [ 668 | { "include": "#functionCallParams" } 669 | ] 670 | }, 671 | { 672 | "name": "constant.language.pine", 673 | "match": "\\b(strategy)\\b" 674 | }, 675 | { 676 | "name": "meta.function-call", 677 | "begin": "\\b(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)|(\\w+))(?=\\()", 678 | "beginCaptures": { 679 | "1" : { "name" : "support.class.builtin.pine" }, 680 | "2" : { "name" : "punctuation.accessor.pine" }, 681 | "4" : { "name" : "support.function.line.pine" }, 682 | "5" : { "name" : "invalid.function.line.pine" } 683 | }, 684 | "end":"(?<=\\))", 685 | "patterns": [ 686 | { "include": "#functionCallParams" } 687 | ] 688 | }, 689 | { 690 | "name": "support.class.builtin.pine", 691 | "match": "\\b(line)\\b" 692 | }, 693 | { 694 | "name": "meta.function-call", 695 | "begin": "\\b(box)(\\.)((new|delete|set_top|set_text|set_text_valign|set_text_halign|set_text_size|set_text_color|set_color|set_extend|set_style|set_width|set_right_bottom|set_right|set_lefttop|set_left|set_extend|set_bottom|set_border_width|set_border_style|set_border_color|set_bgcolor|get_top|get_right|get_left|get_bottom)|(\\w+))(?=\\()", 696 | "beginCaptures": { 697 | "1" : { "name" : "support.class.builtin.pine" }, 698 | "2" : { "name" : "punctuation.accessor.pine" }, 699 | "4" : { "name" : "support.function.box.pine" }, 700 | "5" : { "name" : "invalid.function.box.pine" } 701 | }, 702 | "end":"(?<=\\))", 703 | "patterns": [ 704 | { "include": "#functionCallParams" } 705 | ] 706 | }, 707 | { 708 | "name": "support.class.builtin.pine", 709 | "match": "\\b(box)\\b" 710 | }, 711 | { 712 | "name": "meta.function-call", 713 | "begin": "\\b(label)(\\.)((delete|get_text|get_x|get_y|new|set_color|set_size|set_text|set_textalign|set_textcolor|set_tooltip|set_x|set_xloc|set_xy|set_y|set_yloc|set_style)|(\\w+))(?=\\()", 714 | "beginCaptures": { 715 | "1" : { "name" : "support.class.builtin.pine" }, 716 | "2" : { "name" : "punctuation.accessor.pine" }, 717 | "4" : { "name" : "support.function.label.pine" }, 718 | "5" : { "name" : "invalid.function.label.pine" } 719 | }, 720 | "end":"(?<=\\))", 721 | "patterns": [ 722 | { "include": "#functionCallParams" } 723 | ] 724 | }, 725 | { 726 | "name": "support.class.builtin.pine", 727 | "match": "\\b(label)\\b" 728 | }, 729 | { 730 | "name": "meta.function-call", 731 | "begin": "\\b(array)(\\.)((avg|clear|concat|copy|covariance|fill|get|includes|indexof|insert|lastindexof|max|median|min|mode|new_(?:bool|float|int|string|color|line|box|label)|pop|push|remove|reverse|set|shift|size|slice|sort|standardize|stdev|sum|unshift|variance)|(\\w+))(?=\\()", 732 | "beginCaptures": { 733 | "1" : { "name" : "support.class.builtin.pine" }, 734 | "2" : { "name" : "punctuation.accessor.pine" }, 735 | "4" : { "name" : "support.function.array.pine" }, 736 | "5" : { "name" : "invalid.function.array.pine" } 737 | }, 738 | "end":"(?<=\\))", 739 | "patterns": [ 740 | { "include": "#functionCallParams" } 741 | ] 742 | }, 743 | { 744 | "name": "support.class.builtin.pine", 745 | "match": "\\b(array)\\b" 746 | }, 747 | { 748 | "name": "meta.function-call", 749 | "begin": "\\b(color)(\\.)((new|rgb|r|g|b|t|from_gradient)|(\\w+))(?=\\()", 750 | "beginCaptures": { 751 | "1" : { "name" : "support.class.builtin.pine" }, 752 | "2" : { "name" : "punctuation.accessor.pine" }, 753 | "4" : { "name" : "support.function.color.pine" }, 754 | "5" : { "name" : "invalid.function.color.pine" } 755 | }, 756 | "end":"(?<=\\))", 757 | "patterns": [ 758 | { "include": "#functionCallParams" } 759 | ] 760 | }, 761 | { 762 | "name": "support.class.builtin.pine", 763 | "match": "\\b(color)\\b" 764 | }, 765 | { 766 | "name": "meta.function-call", 767 | "begin": "\\b(runtime)(\\.)((error)|(\\w+))(?=\\()", 768 | "beginCaptures": { 769 | "1" : { "name" : "support.class.builtin.pine" }, 770 | "2" : { "name" : "punctuation.accessor.pine" }, 771 | "4" : { "name" : "support.function.color.pine" }, 772 | "5" : { "name" : "invalid.function.color.pine" } 773 | }, 774 | "end":"(?<=\\))", 775 | "patterns": [ 776 | { "include": "#functionCallParams" } 777 | ] 778 | }, 779 | { 780 | "name": "support.class.builtin.pine", 781 | "match": "\\b(error)\\b" 782 | } 783 | ] 784 | }, 785 | "constants": { 786 | "patterns": [ 787 | { 788 | "match": "\\b(bar_index|close|dayofmonth|dayofweek|high|hl2|hlc3|hour|low|minute|month|na|nvi|obv|ohlc4|open|second|time|time_close|timenow|volume|weekofyear|year)\\b", 789 | "name": "constant.language.pine" 790 | }, 791 | { 792 | "match": "\\b(timeframe)(\\.)(isdaily|isdwm|isintraday|isminutes|ismonthly|isseconds|isweekly|multiplier|period)\\b", 793 | "captures": { 794 | "1" : { "name" : "support.class.builtin.pine" }, 795 | "2" : { "name" : "punctuation.accessor.pine" }, 796 | "3" : { "name" : "constant.language.pine" } 797 | } 798 | }, 799 | { 800 | "match": "\\b(syminfo)(\\.)(basecurrency|currency|description|mintick|pointvalue|prefix|root|session|ticker|tickerid|timezone|type)\\b", 801 | "captures": { 802 | "1" : { "name" : "support.class.builtin.pine" }, 803 | "2" : { "name" : "punctuation.accessor.pine" }, 804 | "3" : { "name" : "constant.language.pine" } 805 | } 806 | }, 807 | { 808 | "match": "\\b(dayofweek)(\\.)(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\\b", 809 | "captures": { 810 | "1" : { "name" : "support.class.builtin.pine" }, 811 | "2" : { "name" : "punctuation.accessor.pine" }, 812 | "3" : { "name" : "constant.language.pine" } 813 | } 814 | }, 815 | { 816 | "match": "\\b(plot)\\.style_(area|areabr|circles|columns|cross|histogram|line|linebr|stepline)\\b", 817 | "captures": { 818 | "1" : { "name" : "support.class.builtin.pine" }, 819 | "2" : { "name" : "punctuation.accessor.pine" }, 820 | "3" : { "name" : "constant.language.pine" } 821 | } 822 | }, 823 | { 824 | "match": "\\b(location)(\\.)(abovebar|belowbar|top|bottom|absolute)\\b", 825 | "captures": { 826 | "1" : { "name" : "support.class.builtin.pine" }, 827 | "2" : { "name" : "punctuation.accessor.pine" }, 828 | "3" : { "name" : "constant.language.pine" } 829 | } 830 | }, 831 | { 832 | "match": "\\b(shape)(\\.)(arrowdown|arrowup|circle|cross|diamond|flag|labeldown|labelup|square|triangledown|triangleup|xcross)\\b", 833 | "captures": { 834 | "1" : { "name" : "support.class.builtin.pine" }, 835 | "2" : { "name" : "punctuation.accessor.pine" }, 836 | "3" : { "name" : "constant.language.pine" } 837 | } 838 | }, 839 | { 840 | "match": "\\b(color)(\\.)(aqua|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|orange)\\b", 841 | "captures": { 842 | "1" : { "name" : "support.class.builtin.pine" }, 843 | "2" : { "name" : "punctuation.accessor.pine" }, 844 | "3" : { "name" : "constant.language.pine" } 845 | } 846 | }, 847 | { 848 | "match": "\\b(currency)(\\.)(AUD|CAD|CHF|EUR|GBP|HKD|JPY|NOK|NONE|NZD|RUB|SEK|SGD|TRY|USD|ZAR)\\b", 849 | "captures": { 850 | "1" : { "name" : "support.class.builtin.pine" }, 851 | "2" : { "name" : "punctuation.accessor.pine" }, 852 | "3" : { "name" : "constant.language.pine" } 853 | } 854 | }, 855 | { 856 | "match": "\\b(barmerge)(\\.)(gaps_off|gaps_on|lookahead_off|lookahead_on)\\b", 857 | "captures": { 858 | "1" : { "name" : "support.class.builtin.pine" }, 859 | "2" : { "name" : "punctuation.accessor.pine" }, 860 | "3" : { "name" : "constant.language.pine" } 861 | } 862 | }, 863 | { 864 | "match": "\\b(barstate)(\\.)(isconfirmed|isfirst|ishistory|islast|isnew|isrealtime)\\b", 865 | "captures": { 866 | "1" : { "name" : "support.class.builtin.pine" }, 867 | "2" : { "name" : "punctuation.accessor.pine" }, 868 | "3" : { "name" : "constant.language.pine" } 869 | } 870 | }, 871 | { 872 | "match": "\\b(adjustment)(\\.)(dividends|none|splits)\\b", 873 | "captures": { 874 | "1" : { "name" : "support.class.builtin.pine" }, 875 | "2" : { "name" : "punctuation.accessor.pine" }, 876 | "3" : { "name" : "constant.language.pine" } 877 | } 878 | }, 879 | { 880 | "match": "\\b(display)(\\.)(all|none)\\b", 881 | "captures": { 882 | "1" : { "name" : "support.class.builtin.pine" }, 883 | "2" : { "name" : "punctuation.accessor.pine" }, 884 | "3" : { "name" : "constant.language.pine" } 885 | } 886 | }, 887 | { 888 | "match": "\\b(extend)(\\.)(both|left|none|right)\\b", 889 | "captures": { 890 | "1" : { "name" : "support.class.builtin.pine" }, 891 | "2" : { "name" : "punctuation.accessor.pine" }, 892 | "3" : { "name" : "constant.language.pine" } 893 | } 894 | }, 895 | { 896 | "match": "\\b(format)(\\.)(inherit|price|volume)\\b", 897 | "captures": { 898 | "1" : { "name" : "support.class.builtin.pine" }, 899 | "2" : { "name" : "punctuation.accessor.pine" }, 900 | "3" : { "name" : "constant.language.pine" } 901 | } 902 | }, 903 | { 904 | "match": "\\b(hline)(\\.)(style_(dashed|dotted|solid))\\b", 905 | "captures": { 906 | "1" : { "name" : "support.class.builtin.pine" }, 907 | "2" : { "name" : "punctuation.accessor.pine" }, 908 | "3" : { "name" : "constant.language.pine" } 909 | } 910 | }, 911 | { 912 | "match": "\\b(label)(\\.)(style_(arrowdown|arrowup|circle|cross|diamond|flag|label_center|label_down|label_left|label_lower_left|label_lower_right|label_right|label_up|label_upper_left|label_upper_right|none|square|triangledown|triangleup|xcross))\\b", 913 | "captures": { 914 | "1" : { "name" : "support.class.builtin.pine" }, 915 | "2" : { "name" : "punctuation.accessor.pine" }, 916 | "3" : { "name" : "constant.language.pine" } 917 | } 918 | }, 919 | { 920 | "match": "\\b(line)(\\.)(style_(arrow_both|arrow_left|arrow_right|dashed|dotted|solid))\\b", 921 | "captures": { 922 | "1" : { "name" : "support.class.builtin.pine" }, 923 | "2" : { "name" : "punctuation.accessor.pine" }, 924 | "3" : { "name" : "constant.language.pine" } 925 | } 926 | }, 927 | { 928 | "match": "\\b(order)(\\.)(ascending|descending)\\b", 929 | "captures": { 930 | "1" : { "name" : "support.class.builtin.pine" }, 931 | "2" : { "name" : "punctuation.accessor.pine" }, 932 | "3" : { "name" : "constant.language.pine" } 933 | } 934 | }, 935 | { 936 | "match": "\\b(scale)(\\.)(left|right|none)\\b", 937 | "captures": { 938 | "1" : { "name" : "support.class.builtin.pine" }, 939 | "2" : { "name" : "punctuation.accessor.pine" }, 940 | "3" : { "name" : "constant.language.pine" } 941 | } 942 | }, 943 | { 944 | "match": "\\b(session)(\\.)(extended|regular)\\b", 945 | "captures": { 946 | "1" : { "name" : "support.class.builtin.pine" }, 947 | "2" : { "name" : "punctuation.accessor.pine" }, 948 | "3" : { "name" : "constant.language.pine" } 949 | } 950 | }, 951 | { 952 | "match": "\\b(size)(\\.)(auto|huge|large|normal|small|tiny)\\b", 953 | "captures": { 954 | "1" : { "name" : "support.class.builtin.pine" }, 955 | "2" : { "name" : "punctuation.accessor.pine" }, 956 | "3" : { "name" : "constant.language.pine" } 957 | } 958 | }, 959 | { 960 | "match": "\\b(strategy)(\\.)(cash|closedtrades|equity|eventrades|fixed|grossloss|grossprofit|initial_capital|long|losstrades|max_drawdown|netprofit|openprofit|opentrades|percent_of_equity|position_avg_price|position_entry_name|position_size|short|wintrades)\\b", 961 | "captures": { 962 | "1" : { "name" : "support.class.builtin.pine" }, 963 | "2" : { "name" : "punctuation.accessor.pine" }, 964 | "3" : { "name" : "constant.language.pine" } 965 | } 966 | }, 967 | { 968 | "match": "\\b(strategy)\\.commission\\.(cash_per_contract|cash_per_order|percent)\\b", 969 | "captures": { 970 | "1" : { "name" : "support.class.builtin.pine" }, 971 | "2" : { "name" : "punctuation.accessor.pine" }, 972 | "3" : { "name" : "constant.language.pine" } 973 | } 974 | }, 975 | { 976 | "match": "\\b(strategy)\\.direction\\.(all|long|short)\\b", 977 | "captures": { 978 | "1" : { "name" : "support.class.builtin.pine" }, 979 | "2" : { "name" : "punctuation.accessor.pine" }, 980 | "3" : { "name" : "constant.language.pine" } 981 | } 982 | }, 983 | { 984 | "match": "\\b(strategy)\\.max_contracts_held_(all|long|short)\\b", 985 | "captures": { 986 | "1" : { "name" : "support.class.builtin.pine" }, 987 | "2" : { "name" : "punctuation.accessor.pine" }, 988 | "3" : { "name" : "constant.language.pine" } 989 | } 990 | }, 991 | { 992 | "match": "\\b(strategy)\\.oca\\.(cancel|none|reduce)\\b", 993 | "captures": { 994 | "1" : { "name" : "support.class.builtin.pine" }, 995 | "2" : { "name" : "punctuation.accessor.pine" }, 996 | "3" : { "name" : "constant.language.pine" } 997 | } 998 | }, 999 | { 1000 | "match": "\\b(text)\\.align_(center|left|right)\\b", 1001 | "captures": { 1002 | "1" : { "name" : "support.class.builtin.pine" }, 1003 | "2" : { "name" : "punctuation.accessor.pine" }, 1004 | "3" : { "name" : "constant.language.pine" } 1005 | } 1006 | }, 1007 | { 1008 | "match": "\\b(xloc)(\\.)(bar_index|bar_time)\\b", 1009 | "captures": { 1010 | "1" : { "name" : "support.class.builtin.pine" }, 1011 | "2" : { "name" : "punctuation.accessor.pine" }, 1012 | "3" : { "name" : "constant.language.pine" } 1013 | } 1014 | }, 1015 | { 1016 | "match": "\\b(yloc)(\\.)(abovebar|belowbar|price)\\b", 1017 | "captures": { 1018 | "1" : { "name" : "support.class.builtin.pine" }, 1019 | "2" : { "name" : "punctuation.accessor.pine" }, 1020 | "3" : { "name" : "constant.language.pine" } 1021 | } 1022 | }, 1023 | { 1024 | "match": "#[a-fA-F0-9]{6}", 1025 | "captures": { 1026 | "1" : { "name" : "support.class.builtin.pine" }, 1027 | "2" : { "name" : "punctuation.accessor.pine" }, 1028 | "3" : { "name" : "constant.language.pine" } 1029 | } 1030 | } 1031 | ] 1032 | }, 1033 | "operators": { 1034 | "patterns": [ 1035 | { 1036 | "match": "\\-|\\+|\\*|/|%", 1037 | "name": "keyword.operator.arithmetic.pine" 1038 | }, 1039 | { 1040 | "match": "==|!=|<=|>=|<|(?", 1041 | "name": "keyword.operator.comparison.pine" 1042 | }, 1043 | { 1044 | "match": "\\?|\\:", 1045 | "name": "keyword.operator.ternary.pine" 1046 | }, 1047 | { 1048 | "match": "\\b(and|or|not)\\b", 1049 | "name": "keyword.operator.logical.pine" 1050 | }, 1051 | { 1052 | "match": "=(?!>)", 1053 | "name": "keyword.operator.assignment.pine" 1054 | }, 1055 | { 1056 | "name": "storage.type.function.arrow.pine", 1057 | "match": "=>" 1058 | }, 1059 | { 1060 | "name": "invalid.operator.pine", 1061 | "match": "[&|]" 1062 | } 1063 | ] 1064 | }, 1065 | "keywords": { 1066 | "patterns": [ 1067 | { 1068 | "name": "keyword.control.pine", 1069 | "match": "\\b(if|else|switch|while|for|return)\\b" 1070 | } 1071 | ] 1072 | }, 1073 | "invalid": { 1074 | "patterns": [ 1075 | { 1076 | "name":"invalid.pine", 1077 | "match":";\\s*$" 1078 | } 1079 | ] 1080 | } 1081 | }, 1082 | "scopeName": "source.pine" 1083 | } -------------------------------------------------------------------------------- /test.pine: -------------------------------------------------------------------------------- 1 | study("MACD") 2 | fast = 12, slow = 26 3 | fastMA = ema(close, fast) 4 | slowMA = ema(close, slow) 5 | macd = fastMA - slowMA 6 | signal = sma(macd, 9) 7 | plot(macd, color=color.blue) 8 | plot(signal, color=color.orange) 9 | --------------------------------------------------------------------------------