pinescript-mcp 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. pinescript_mcp/__init__.py +7 -0
  2. pinescript_mcp/__main__.py +6 -0
  3. pinescript_mcp/docs/LLM_MANIFEST.md +96 -0
  4. pinescript_mcp/docs/concepts/colors_and_display.md +574 -0
  5. pinescript_mcp/docs/concepts/common_errors.md +550 -0
  6. pinescript_mcp/docs/concepts/execution_model.md +1059 -0
  7. pinescript_mcp/docs/concepts/methods.md +543 -0
  8. pinescript_mcp/docs/concepts/objects.md +349 -0
  9. pinescript_mcp/docs/concepts/timeframes.md +73 -0
  10. pinescript_mcp/docs/pine_v6_functions.json +488 -0
  11. pinescript_mcp/docs/reference/annotations.md +229 -0
  12. pinescript_mcp/docs/reference/constants.md +1694 -0
  13. pinescript_mcp/docs/reference/functions/collections.md +2793 -0
  14. pinescript_mcp/docs/reference/functions/drawing.md +1082 -0
  15. pinescript_mcp/docs/reference/functions/general.md +1892 -0
  16. pinescript_mcp/docs/reference/functions/request.md +232 -0
  17. pinescript_mcp/docs/reference/functions/strategy.md +1517 -0
  18. pinescript_mcp/docs/reference/functions/ta.md +1225 -0
  19. pinescript_mcp/docs/reference/keywords.md +487 -0
  20. pinescript_mcp/docs/reference/operators.md +311 -0
  21. pinescript_mcp/docs/reference/pine_v6_cheatsheet.md +183 -0
  22. pinescript_mcp/docs/reference/types.md +405 -0
  23. pinescript_mcp/docs/reference/variables.md +2272 -0
  24. pinescript_mcp/docs/visuals/backgrounds.md +110 -0
  25. pinescript_mcp/docs/visuals/bar_coloring.md +35 -0
  26. pinescript_mcp/docs/visuals/bar_plotting.md +93 -0
  27. pinescript_mcp/docs/visuals/colors.md +574 -0
  28. pinescript_mcp/docs/visuals/fills.md +497 -0
  29. pinescript_mcp/docs/visuals/levels.md +91 -0
  30. pinescript_mcp/docs/visuals/lines_and_boxes.md +1252 -0
  31. pinescript_mcp/docs/visuals/overview.md +563 -0
  32. pinescript_mcp/docs/visuals/plots.md +390 -0
  33. pinescript_mcp/docs/visuals/tables.md +207 -0
  34. pinescript_mcp/docs/visuals/texts_and_shapes.md +862 -0
  35. pinescript_mcp/docs/writing_scripts/debugging.md +1943 -0
  36. pinescript_mcp/docs/writing_scripts/limitations.md +457 -0
  37. pinescript_mcp/docs/writing_scripts/profiling_and_optimization.md +2016 -0
  38. pinescript_mcp/docs/writing_scripts/publishing_scripts.md +327 -0
  39. pinescript_mcp/docs/writing_scripts/style_guide.md +245 -0
  40. pinescript_mcp/server.py +570 -0
  41. pinescript_mcp-0.1.0.dist-info/METADATA +121 -0
  42. pinescript_mcp-0.1.0.dist-info/RECORD +45 -0
  43. pinescript_mcp-0.1.0.dist-info/WHEEL +4 -0
  44. pinescript_mcp-0.1.0.dist-info/entry_points.txt +2 -0
  45. pinescript_mcp-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,488 @@
1
+ {
2
+ "functions": [
3
+ "array.abs",
4
+ "array.avg",
5
+ "array.binary_search",
6
+ "array.binary_search_leftmost",
7
+ "array.binary_search_rightmost",
8
+ "array.clear",
9
+ "array.concat",
10
+ "array.copy",
11
+ "array.covariance",
12
+ "array.every",
13
+ "array.fill",
14
+ "array.first",
15
+ "array.from",
16
+ "array.get",
17
+ "array.includes",
18
+ "array.indexof",
19
+ "array.insert",
20
+ "array.join",
21
+ "array.last",
22
+ "array.lastindexof",
23
+ "array.max",
24
+ "array.median",
25
+ "array.min",
26
+ "array.mode",
27
+ "array.new_bool",
28
+ "array.new_box",
29
+ "array.new_color",
30
+ "array.new_float",
31
+ "array.new_int",
32
+ "array.new_label",
33
+ "array.new_line",
34
+ "array.new_linefill",
35
+ "array.new_string",
36
+ "array.new_table",
37
+ "array.percentile_linear_interpolation",
38
+ "array.percentile_nearest_rank",
39
+ "array.percentrank",
40
+ "array.pop",
41
+ "array.push",
42
+ "array.range",
43
+ "array.remove",
44
+ "array.reverse",
45
+ "array.set",
46
+ "array.shift",
47
+ "array.size",
48
+ "array.slice",
49
+ "array.some",
50
+ "array.sort",
51
+ "array.sort_indices",
52
+ "array.standardize",
53
+ "array.stdev",
54
+ "array.sum",
55
+ "array.unshift",
56
+ "array.variance",
57
+ "box.copy",
58
+ "box.delete",
59
+ "box.get_bottom",
60
+ "box.get_left",
61
+ "box.get_right",
62
+ "box.get_top",
63
+ "box.new",
64
+ "box.set_bgcolor",
65
+ "box.set_border_color",
66
+ "box.set_border_style",
67
+ "box.set_border_width",
68
+ "box.set_bottom",
69
+ "box.set_bottom_right_point",
70
+ "box.set_extend",
71
+ "box.set_left",
72
+ "box.set_lefttop",
73
+ "box.set_right",
74
+ "box.set_rightbottom",
75
+ "box.set_text",
76
+ "box.set_text_color",
77
+ "box.set_text_font_family",
78
+ "box.set_text_formatting",
79
+ "box.set_text_halign",
80
+ "box.set_text_size",
81
+ "box.set_text_valign",
82
+ "box.set_text_wrap",
83
+ "box.set_top",
84
+ "box.set_top_left_point",
85
+ "box.set_xloc",
86
+ "chart.point.copy",
87
+ "chart.point.from_index",
88
+ "chart.point.from_time",
89
+ "chart.point.new",
90
+ "chart.point.now",
91
+ "color.b",
92
+ "color.from_gradient",
93
+ "color.g",
94
+ "color.new",
95
+ "color.r",
96
+ "color.rgb",
97
+ "color.t",
98
+ "input.bool",
99
+ "input.color",
100
+ "input.enum",
101
+ "input.float",
102
+ "input.int",
103
+ "input.price",
104
+ "input.session",
105
+ "input.source",
106
+ "input.string",
107
+ "input.symbol",
108
+ "input.text_area",
109
+ "input.time",
110
+ "input.timeframe",
111
+ "label.copy",
112
+ "label.delete",
113
+ "label.get_text",
114
+ "label.get_x",
115
+ "label.get_y",
116
+ "label.new",
117
+ "label.set_color",
118
+ "label.set_point",
119
+ "label.set_size",
120
+ "label.set_style",
121
+ "label.set_text",
122
+ "label.set_text_font_family",
123
+ "label.set_text_formatting",
124
+ "label.set_textalign",
125
+ "label.set_textcolor",
126
+ "label.set_tooltip",
127
+ "label.set_x",
128
+ "label.set_xloc",
129
+ "label.set_xy",
130
+ "label.set_y",
131
+ "label.set_yloc",
132
+ "line.copy",
133
+ "line.delete",
134
+ "line.get_price",
135
+ "line.get_x1",
136
+ "line.get_x2",
137
+ "line.get_y1",
138
+ "line.get_y2",
139
+ "line.new",
140
+ "line.set_color",
141
+ "line.set_extend",
142
+ "line.set_first_point",
143
+ "line.set_second_point",
144
+ "line.set_style",
145
+ "line.set_width",
146
+ "line.set_x1",
147
+ "line.set_x2",
148
+ "line.set_xloc",
149
+ "line.set_xy1",
150
+ "line.set_xy2",
151
+ "line.set_y1",
152
+ "line.set_y2",
153
+ "linefill.delete",
154
+ "linefill.get_line1",
155
+ "linefill.get_line2",
156
+ "linefill.new",
157
+ "linefill.set_color",
158
+ "log.error",
159
+ "log.info",
160
+ "log.warning",
161
+ "map.clear",
162
+ "map.contains",
163
+ "map.copy",
164
+ "map.get",
165
+ "map.keys",
166
+ "map.put",
167
+ "map.put_all",
168
+ "map.remove",
169
+ "map.size",
170
+ "map.values",
171
+ "math.abs",
172
+ "math.acos",
173
+ "math.asin",
174
+ "math.atan",
175
+ "math.avg",
176
+ "math.ceil",
177
+ "math.cos",
178
+ "math.exp",
179
+ "math.floor",
180
+ "math.log",
181
+ "math.log10",
182
+ "math.max",
183
+ "math.min",
184
+ "math.pow",
185
+ "math.random",
186
+ "math.round",
187
+ "math.round_to_mintick",
188
+ "math.sign",
189
+ "math.sin",
190
+ "math.sqrt",
191
+ "math.sum",
192
+ "math.tan",
193
+ "math.todegrees",
194
+ "math.toradians",
195
+ "matrix.add_col",
196
+ "matrix.add_row",
197
+ "matrix.avg",
198
+ "matrix.col",
199
+ "matrix.columns",
200
+ "matrix.concat",
201
+ "matrix.copy",
202
+ "matrix.det",
203
+ "matrix.diff",
204
+ "matrix.eigenvalues",
205
+ "matrix.eigenvectors",
206
+ "matrix.elements_count",
207
+ "matrix.fill",
208
+ "matrix.get",
209
+ "matrix.inv",
210
+ "matrix.is_antidiagonal",
211
+ "matrix.is_antisymmetric",
212
+ "matrix.is_binary",
213
+ "matrix.is_diagonal",
214
+ "matrix.is_identity",
215
+ "matrix.is_square",
216
+ "matrix.is_stochastic",
217
+ "matrix.is_symmetric",
218
+ "matrix.is_triangular",
219
+ "matrix.is_zero",
220
+ "matrix.kron",
221
+ "matrix.max",
222
+ "matrix.median",
223
+ "matrix.min",
224
+ "matrix.mode",
225
+ "matrix.mult",
226
+ "matrix.pinv",
227
+ "matrix.pow",
228
+ "matrix.rank",
229
+ "matrix.remove_col",
230
+ "matrix.remove_row",
231
+ "matrix.reshape",
232
+ "matrix.reverse",
233
+ "matrix.row",
234
+ "matrix.rows",
235
+ "matrix.set",
236
+ "matrix.sort",
237
+ "matrix.submatrix",
238
+ "matrix.sum",
239
+ "matrix.swap_columns",
240
+ "matrix.swap_rows",
241
+ "matrix.trace",
242
+ "matrix.transpose",
243
+ "polyline.delete",
244
+ "polyline.new",
245
+ "request.currency_rate",
246
+ "request.dividends",
247
+ "request.earnings",
248
+ "request.economic",
249
+ "request.financial",
250
+ "request.quandl",
251
+ "request.security",
252
+ "request.security_lower_tf",
253
+ "request.seed",
254
+ "request.splits",
255
+ "runtime.error",
256
+ "str.contains",
257
+ "str.endswith",
258
+ "str.format",
259
+ "str.format_time",
260
+ "str.length",
261
+ "str.lower",
262
+ "str.match",
263
+ "str.pos",
264
+ "str.repeat",
265
+ "str.replace",
266
+ "str.replace_all",
267
+ "str.split",
268
+ "str.startswith",
269
+ "str.substring",
270
+ "str.tonumber",
271
+ "str.tostring",
272
+ "str.trim",
273
+ "str.upper",
274
+ "strategy.cancel",
275
+ "strategy.cancel_all",
276
+ "strategy.close",
277
+ "strategy.close_all",
278
+ "strategy.closedtrades.commission",
279
+ "strategy.closedtrades.entry_bar_index",
280
+ "strategy.closedtrades.entry_comment",
281
+ "strategy.closedtrades.entry_id",
282
+ "strategy.closedtrades.entry_price",
283
+ "strategy.closedtrades.entry_time",
284
+ "strategy.closedtrades.exit_bar_index",
285
+ "strategy.closedtrades.exit_comment",
286
+ "strategy.closedtrades.exit_id",
287
+ "strategy.closedtrades.exit_price",
288
+ "strategy.closedtrades.exit_time",
289
+ "strategy.closedtrades.max_drawdown",
290
+ "strategy.closedtrades.max_drawdown_percent",
291
+ "strategy.closedtrades.max_runup",
292
+ "strategy.closedtrades.max_runup_percent",
293
+ "strategy.closedtrades.profit",
294
+ "strategy.closedtrades.profit_percent",
295
+ "strategy.closedtrades.size",
296
+ "strategy.convert_to_account",
297
+ "strategy.convert_to_symbol",
298
+ "strategy.default_entry_qty",
299
+ "strategy.entry",
300
+ "strategy.exit",
301
+ "strategy.opentrades.commission",
302
+ "strategy.opentrades.entry_bar_index",
303
+ "strategy.opentrades.entry_comment",
304
+ "strategy.opentrades.entry_id",
305
+ "strategy.opentrades.entry_price",
306
+ "strategy.opentrades.entry_time",
307
+ "strategy.opentrades.max_drawdown",
308
+ "strategy.opentrades.max_drawdown_percent",
309
+ "strategy.opentrades.max_runup",
310
+ "strategy.opentrades.max_runup_percent",
311
+ "strategy.opentrades.profit",
312
+ "strategy.opentrades.profit_percent",
313
+ "strategy.opentrades.size",
314
+ "strategy.order",
315
+ "strategy.risk.allow_entry_in",
316
+ "strategy.risk.max_cons_loss_days",
317
+ "strategy.risk.max_drawdown",
318
+ "strategy.risk.max_intraday_filled_orders",
319
+ "strategy.risk.max_intraday_loss",
320
+ "strategy.risk.max_position_size",
321
+ "syminfo.prefix",
322
+ "syminfo.ticker",
323
+ "ta.alma",
324
+ "ta.atr",
325
+ "ta.barssince",
326
+ "ta.bb",
327
+ "ta.bbw",
328
+ "ta.cci",
329
+ "ta.change",
330
+ "ta.cmo",
331
+ "ta.cog",
332
+ "ta.correlation",
333
+ "ta.cross",
334
+ "ta.crossover",
335
+ "ta.crossunder",
336
+ "ta.cum",
337
+ "ta.dev",
338
+ "ta.dmi",
339
+ "ta.ema",
340
+ "ta.falling",
341
+ "ta.highest",
342
+ "ta.highestbars",
343
+ "ta.hma",
344
+ "ta.kc",
345
+ "ta.kcw",
346
+ "ta.linreg",
347
+ "ta.lowest",
348
+ "ta.lowestbars",
349
+ "ta.macd",
350
+ "ta.max",
351
+ "ta.median",
352
+ "ta.mfi",
353
+ "ta.min",
354
+ "ta.mode",
355
+ "ta.mom",
356
+ "ta.percentile_linear_interpolation",
357
+ "ta.percentile_nearest_rank",
358
+ "ta.percentrank",
359
+ "ta.pivot_point_levels",
360
+ "ta.pivothigh",
361
+ "ta.pivotlow",
362
+ "ta.range",
363
+ "ta.rci",
364
+ "ta.rising",
365
+ "ta.rma",
366
+ "ta.roc",
367
+ "ta.rsi",
368
+ "ta.sar",
369
+ "ta.sma",
370
+ "ta.stdev",
371
+ "ta.stoch",
372
+ "ta.supertrend",
373
+ "ta.swma",
374
+ "ta.tr",
375
+ "ta.tsi",
376
+ "ta.valuewhen",
377
+ "ta.variance",
378
+ "ta.vwap",
379
+ "ta.vwma",
380
+ "ta.wma",
381
+ "ta.wpr",
382
+ "table.cell",
383
+ "table.cell_set_bgcolor",
384
+ "table.cell_set_height",
385
+ "table.cell_set_text",
386
+ "table.cell_set_text_color",
387
+ "table.cell_set_text_font_family",
388
+ "table.cell_set_text_formatting",
389
+ "table.cell_set_text_halign",
390
+ "table.cell_set_text_size",
391
+ "table.cell_set_text_valign",
392
+ "table.cell_set_tooltip",
393
+ "table.cell_set_width",
394
+ "table.clear",
395
+ "table.delete",
396
+ "table.merge_cells",
397
+ "table.new",
398
+ "table.set_bgcolor",
399
+ "table.set_border_color",
400
+ "table.set_border_width",
401
+ "table.set_frame_color",
402
+ "table.set_frame_width",
403
+ "table.set_position",
404
+ "ticker.heikinashi",
405
+ "ticker.inherit",
406
+ "ticker.kagi",
407
+ "ticker.linebreak",
408
+ "ticker.modify",
409
+ "ticker.new",
410
+ "ticker.pointfigure",
411
+ "ticker.renko",
412
+ "ticker.standard",
413
+ "timeframe.change",
414
+ "timeframe.from_seconds",
415
+ "timeframe.in_seconds"
416
+ ],
417
+ "namespaces": [
418
+ "array",
419
+ "box",
420
+ "chart.point",
421
+ "color",
422
+ "input",
423
+ "label",
424
+ "line",
425
+ "linefill",
426
+ "log",
427
+ "map",
428
+ "math",
429
+ "matrix",
430
+ "polyline",
431
+ "request",
432
+ "runtime",
433
+ "str",
434
+ "strategy",
435
+ "strategy.closedtrades",
436
+ "strategy.opentrades",
437
+ "strategy.risk",
438
+ "syminfo",
439
+ "ta",
440
+ "table",
441
+ "ticker",
442
+ "timeframe"
443
+ ],
444
+ "toplevel": [
445
+ "alert",
446
+ "alertcondition",
447
+ "barcolor",
448
+ "bgcolor",
449
+ "bool",
450
+ "box",
451
+ "color",
452
+ "dayofmonth",
453
+ "dayofweek",
454
+ "fill",
455
+ "fixnan",
456
+ "float",
457
+ "hline",
458
+ "hour",
459
+ "indicator",
460
+ "input",
461
+ "int",
462
+ "label",
463
+ "library",
464
+ "line",
465
+ "linefill",
466
+ "max_bars_back",
467
+ "minute",
468
+ "month",
469
+ "na",
470
+ "nz",
471
+ "plot",
472
+ "plotarrow",
473
+ "plotbar",
474
+ "plotcandle",
475
+ "plotchar",
476
+ "plotshape",
477
+ "polyline",
478
+ "second",
479
+ "strategy",
480
+ "string",
481
+ "table",
482
+ "time",
483
+ "time_close",
484
+ "timestamp",
485
+ "weekofyear",
486
+ "year"
487
+ ]
488
+ }
@@ -0,0 +1,229 @@
1
+ # Annotations
2
+
3
+ ## @description
4
+
5
+ Sets a custom description for scripts that use the library declaration statement. The text provided with this annotation will be used to pre-fill the "Description" field in the publication dialogue.
6
+
7
+ ### Code Example
8
+ ```pine
9
+ //@version=6
10
+ // @description Provides a tool to quickly output a label on the chart.
11
+ library("MyLibrary")
12
+
13
+ // @function Outputs a label with `labelText` on the bar's high.
14
+ // @param labelText (series string) The text to display on the label.
15
+ // @returns Drawn label.
16
+ export drawLabel(string labelText) =>
17
+ label.new(bar_index, high, text = labelText)
18
+ ```
19
+
20
+ ---
21
+
22
+ ## @enum
23
+
24
+ If placed above an enum declaration, it adds a custom description for the enum. The Pine Editor's autosuggest uses this description and displays it when a user hovers over the enum name. When used in library scripts, the descriptions of all enums using the export keyword will pre-fill the "Description" field in the publication dialogue.
25
+
26
+ ### Code Example
27
+ ```pine
28
+ //@version=6
29
+ indicator("Session highlight", overlay = true)
30
+
31
+ //@enum Contains fields with popular timezones as titles.
32
+ //@field exch Has an empty string as the title to represent the chart timezone.
33
+ enum tz
34
+ utc = "UTC"
35
+ exch = ""
36
+ ny = "America/New_York"
37
+ chi = "America/Chicago"
38
+ lon = "Europe/London"
39
+ tok = "Asia/Tokyo"
40
+
41
+ //@variable The session string.
42
+ selectedSession = input.session("1200-1500", "Session")
43
+ //@variable The selected timezone. The input's dropdown contains the fields in the `tz` enum.
44
+ selectedTimezone = input.enum(tz.utc, "Session Timezone")
45
+
46
+ //@variable Is `true` if the current bar's time is in the specified session.
47
+ bool inSession = false
48
+ if not na(time("", selectedSession, str.tostring(selectedTimezone)))
49
+ inSession := true
50
+
51
+ // Highlight the background when `inSession` is `true`.
52
+ bgcolor(inSession ? color.new(color.green, 90) : na, title = "Active session highlight")
53
+ ```
54
+
55
+ ---
56
+
57
+ ## @field
58
+
59
+ If placed above a type or enum declaration, it adds a custom description for a field of the type/enum. After the annotation, users should specify the field name, followed by its description.
60
+
61
+ ### Code Example
62
+ ```pine
63
+ //@version=6
64
+ indicator("New high over the last 20 bars", overlay = true)
65
+
66
+ //@type A point on a chart.
67
+ //@field index The index of the bar where the point is located, i.e., its `x` coordinate.
68
+ //@field price The price where the point is located, i.e., its `y` coordinate.
69
+ type Point
70
+ int index
71
+ float price
72
+
73
+ //@variable If the current `high` is the highest over the last 20 bars, returns a new `Point` instance, `na` otherwise.
74
+ Point highest = na
75
+
76
+ if ta.highestbars(high, 20) == 0
77
+ highest := Point.new(bar_index, high)
78
+ label.new(highest.index, highest.price, str.tostring(highest.price))
79
+ ```
80
+
81
+ ---
82
+
83
+ ## @function
84
+
85
+ If placed above a function declaration, it adds a custom description for the function.
86
+
87
+ ### Code Example
88
+ ```pine
89
+ //@version=6
90
+ // @description Provides a tool to quickly output a label on the chart.
91
+ library("MyLibrary")
92
+
93
+ // @function Outputs a label with `labelText` on the bar's high.
94
+ // @param labelText (series string) The text to display on the label.
95
+ // @returns Drawn label.
96
+ export drawLabel(string labelText) =>
97
+ label.new(bar_index, high, text = labelText)
98
+ ```
99
+
100
+ ---
101
+
102
+ ## @param
103
+
104
+ If placed above a function declaration, it adds a custom description for a function parameter. After the annotation, users should specify the parameter name, then its description.
105
+
106
+ ### Code Example
107
+ ```pine
108
+ //@version=6
109
+ // @description Provides a tool to quickly output a label on the chart.
110
+ library("MyLibrary")
111
+
112
+ // @function Outputs a label with `labelText` on the bar's high.
113
+ // @param labelText (series string) The text to display on the label.
114
+ // @returns Drawn label.
115
+ export drawLabel(string labelText) =>
116
+ label.new(bar_index, high, text = labelText)
117
+ ```
118
+
119
+ ---
120
+
121
+ ## @returns
122
+
123
+ If placed above a function declaration, it adds a custom description for what that function returns.
124
+
125
+ ### Code Example
126
+ ```pine
127
+ //@version=6
128
+ // @description Provides a tool to quickly output a label on the chart.
129
+ library("MyLibrary")
130
+
131
+ // @function Outputs a label with `labelText` on the bar's high.
132
+ // @param labelText (series string) The text to display on the label.
133
+ // @returns Drawn label.
134
+ export drawLabel(string labelText) =>
135
+ label.new(bar_index, high, text = labelText)
136
+ ```
137
+
138
+ ---
139
+
140
+ ## @strategy_alert_message
141
+
142
+ If used within a strategy script, it provides a default message to pre-fill the "Message" field in the alert creation dialogue.
143
+
144
+ ### Code Example
145
+ ```pine
146
+ //@version=6
147
+ strategy("My strategy", overlay=true, margin_long=100, margin_short=100)
148
+ //@strategy_alert_message Strategy alert on symbol {{ticker}}
149
+
150
+ longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
151
+ if (longCondition)
152
+ strategy.entry("My Long Entry Id", strategy.long)
153
+ strategy.exit("Exit", "My Long Entry Id", profit = 10 / syminfo.mintick, loss = 10 / syminfo.mintick)
154
+ ```
155
+
156
+ ---
157
+
158
+ ## @type
159
+
160
+ If placed above a type declaration, it adds a custom description for the type.
161
+
162
+ ### Code Example
163
+ ```pine
164
+ //@version=6
165
+ indicator("New high over the last 20 bars", overlay = true)
166
+
167
+ //@type A point on a chart.
168
+ //@field index The index of the bar where the point is located, i.e., its `x` coordinate.
169
+ //@field price The price where the point is located, i.e., its `y` coordinate.
170
+ type Point
171
+ int index
172
+ float price
173
+
174
+ //@variable If the current `high` is the highest over the last 20 bars, returns a new `Point` instance, `na` otherwise.
175
+ Point highest = na
176
+
177
+ if ta.highestbars(high, 20) == 0
178
+ highest := Point.new(bar_index, high)
179
+ label.new(highest.index, highest.price, str.tostring(highest.price))
180
+ ```
181
+
182
+ ---
183
+
184
+ ## @variable
185
+
186
+ If placed above a variable declaration, it adds a custom description for the variable.
187
+
188
+ ### Code Example
189
+ ```pine
190
+ //@version=6
191
+ indicator("New high over the last 20 bars", overlay = true)
192
+
193
+ //@type A point on a chart.
194
+ //@field index The index of the bar where the point is located, i.e., its `x` coordinate.
195
+ //@field price The price where the point is located, i.e., its `y` coordinate.
196
+ type Point
197
+ int index
198
+ float price
199
+
200
+ //@variable If the current `high` is the highest over the last 20 bars, returns a new `Point` instance, `na` otherwise.
201
+ Point highest = na
202
+
203
+ if ta.highestbars(high, 20) == 0
204
+ highest := Point.new(bar_index, high)
205
+ label.new(highest.index, highest.price, str.tostring(highest.price))
206
+ ```
207
+
208
+ ---
209
+
210
+ ## @version=
211
+
212
+ Specifies the Pine Script® version that the script will use. The number in this annotation should not be confused with the script's version number, which updates on every saved change to the code.
213
+
214
+ ### Remarks
215
+ The version should always be specified. Otherwise, for compatibility reasons, the script will be compiled using Pine Script® v1, which lacks most of the newer features and is bound to confuse. This annotation can be anywhere within a script, but we recommend placing it at the top of the code for readability.
216
+
217
+ ### Code Example
218
+ ```pine
219
+ //@version=6
220
+ indicator("Pine v6 Indicator")
221
+ plot(close)
222
+
223
+ //This indicator has no version annotation, so it will try to use v1.
224
+ //Pine Script® v1 has no function named `indicator()`, so the script will not compile.
225
+ indicator("Pine v1 Indicator")
226
+ plot(close)
227
+ ```
228
+
229
+ ---