Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit 2f188b3

Browse files
authored
Merge pull request leifcr#5 from Jos512/pinev4
Add Pine Script version 4
2 parents 2bc8424 + 893f798 commit 2f188b3

File tree

1 file changed

+146
-6
lines changed

1 file changed

+146
-6
lines changed

syntaxes/pine.tmLanguage.json

+146-6
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,47 @@
7272
"functions": {
7373
"patterns": [
7474
{
75-
"match": "\\b(avg|bar(color|since)|bgcolor|change|cross|donchian|falling|fill|highest|iff|input|lowest|m(ax|in)|plot(arrow|bar|candle|char|shape|figure)?|rising|security|tostring|(e|s)ma|study|valuewhen)(?=\\()",
75+
"match": "\\b(abs|acos|alertcondition|alma|asin|atan|atr|avg|barcolor|barssince|bb|bbw|bgcolor|bool|cci|ceil|change|cmo|cog|color|color\\.new|correlation|cos|cross|crossover|crossunder|cum|dayofmonth|dayofweek|dev|dmi|ema|exp|falling|fill|financial|fixnan|float|floor|heikinashi|highest|highestbars|hline|hma|hour|iff|input|int|kagi|kc|kcw|label|line|linebreak|linreg|log|log10|lowest|lowestbars|macd|max|max_bars_back|mfi|min|minute|mom|month|na|nz|offset|percentile_linear_interpolation|percentile_nearest_rank|pivothigh|pivotlow|plot|plotarrow|plotbar|plotcandle|plotchar|plotshape|pointfigure|pow|quandl|renko|rising|rma|roc|round|rsi|sar|second|security|sign|sin|sma|sqrt|stdev|stoch|str\\.replace_all|strategy|string|study|sum|supertrend|swma|tan|tickerid|time|timestamp|tostring|tr|tsi|valuewhen|variance|vwma|weekofyear|wma|wpr|year)(?=\\()",
76+
"captures": {
77+
"1": {
78+
"name": "support.function.pine"
79+
}
80+
}
81+
},
82+
{
83+
"match": "\\barray\\.(avg|clear|concat|copy|covariance|fill|get|includes|indexof|insert|lastindexof|max|median|min|mode|new_bool|new_color|new_float|new_int|pop|push|remove|reverse|set|shift|size|slice|sort|standardize|stdev|sum|unshift|variance)(?=\\()",
84+
"captures": {
85+
"1": {
86+
"name": "support.function.pine"
87+
}
88+
}
89+
},
90+
{
91+
"match": "\\blabel\\.(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)(?=\\()",
92+
"captures": {
93+
"1": {
94+
"name": "support.function.pine"
95+
}
96+
}
97+
},
98+
{
99+
"match": "\\bline\\.(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)(?=\\()",
100+
"captures": {
101+
"1": {
102+
"name": "support.function.pine"
103+
}
104+
}
105+
},
106+
{
107+
"match": "\\bstrategy\\.(cancel|cancel_all|close|close_all|entry|exit|order)(?=\\()",
108+
"captures": {
109+
"1": {
110+
"name": "support.function.pine"
111+
}
112+
}
113+
},
114+
{
115+
"match": "\\bstrategy\\.risk\\.(allow_entry_in|max_cons_loss_days|max_drawdown|max_intraday_filled_orders|max_intraday_loss|max_position_size)(?=\\()",
76116
"captures": {
77117
"1": {
78118
"name": "support.function.pine"
@@ -103,27 +143,127 @@
103143
"name": "constant.language.pine"
104144
},
105145
{
106-
"match": "\\b(open|high|low|close|volume|na|len|period|tikerid)\\b",
146+
"match": "\\b(accdist|bar_index|close|dayofmonth|dayofweek|high|hl2|hlc3|hour|iii|low|minute|month|na|nvi|obv|ohlc4|open|pvi|pvt|second|time|time_close|timenow|tr|volume|vwap|wad|weekofyear|wvad|year|)\\b",
107147
"name": "constant.language.pine"
108148
},
109149
{
110-
"match": "\\b(monday|tuesday|wednesday|thursday|friday|saturday|sunday|dayofweek)\\b",
150+
"match": "\\btimeframe\\.(isdaily|isdwm|isintraday|isminutes|ismonthly|isseconds|isweekly|multiplier|period)\\b",
111151
"name": "constant.language.pine"
112152
},
113153
{
114-
"match": "\\b(line|histogram|cross|area|columns|circles)\\b",
154+
"match": "\\bsyminfo\\.(basecurrency|currency|description|mintick|pointvalue|prefix|root|session|ticker|tickerid|timezone|type)\\b",
155+
"name": "constant.language.pine"
156+
},
157+
{
158+
"match": "\\bdayofweek\\.(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\\b",
159+
"name": "constant.language.pine"
160+
},
161+
{
162+
"match": "\\bplot\\.style_(area|areabr|circles|columns|cross|histogram|line|linebr|stepline)\\b",
115163
"name": "constant.language.pine"
116164
},
117165
{
118166
"match": "\\blocation\\.(abovebar|belowbar|top|bottom|absolute)\\b",
119167
"name": "constant.language.pine"
120168
},
121169
{
122-
"match": "\\bshape\\.(x(cross)?|(triangle|arrow|label)(up|down)|flag|circle|square|diamond)\\b",
170+
"match": "\\bshape\\.(arrowdown|arrowup|circle|cross|diamond|flag|labeldown|labelup|square|triangledown|triangleup|xcross)\\b",
171+
"name": "constant.language.pine"
172+
},
173+
{
174+
"match": "\\bcolor\\.(aqua|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|orange)\\b",
175+
"name": "constant.language.pine"
176+
},
177+
{
178+
"match": "\\bcurrency\\.(AUD|CAD|CHF|EUR|GBP|HKD|JPY|NOK|NONE|NZD|RUB|SEK|SGD|TRY|USD|ZAR)\\b",
179+
"name": "constant.language.pine"
180+
},
181+
{
182+
"match": "\\bbarmerge\\.(gaps_off|gaps_on|lookahead_off|lookahead_on)\\b",
183+
"name": "constant.language.pine"
184+
},
185+
{
186+
"match": "\\bbarstate\\.(isconfirmed|isfirst|ishistory|islast|isnew|isrealtime)\\b",
187+
"name": "constant.language.pine"
188+
},
189+
{
190+
"match": "\\badjustment\\.(dividends|none|splits)\\b",
191+
"name": "constant.language.pine"
192+
},
193+
{
194+
"match": "\\bdisplay\\.(all|none)\\b",
195+
"name": "constant.language.pine"
196+
},
197+
{
198+
"match": "\\bextend\\.(both|left|none|right)\\b",
199+
"name": "constant.language.pine"
200+
},
201+
{
202+
"match": "\\bformat\\.(inherit|price|volume)\\b",
203+
"name": "constant.language.pine"
204+
},
205+
{
206+
"match": "\\bhline\\.style_(dashed|dotted|solid)\\b",
207+
"name": "constant.language.pine"
208+
},
209+
{
210+
"match": "\\binput\\.(bool|color|float|integer|resolution|session|source|string|symbol)\\b",
211+
"name": "constant.language.pine"
212+
},
213+
{
214+
"match": "\\blabel\\.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",
215+
"name": "constant.language.pine"
216+
},
217+
{
218+
"match": "\\bline\\.style_(arrow_both|arrow_left|arrow_right|dashed|dotted|solid)\\b",
219+
"name": "constant.language.pine"
220+
},
221+
{
222+
"match": "\\border\\.(ascending|descending)\\b",
223+
"name": "constant.language.pine"
224+
},
225+
{
226+
"match": "\\bscale\\.(left|right|none)\\b",
227+
"name": "constant.language.pine"
228+
},
229+
{
230+
"match": "\\bsession\\.(extended|regular)\\b",
231+
"name": "constant.language.pine"
232+
},
233+
{
234+
"match": "\\bsize\\.(auto|huge|large|normal|small|tiny)\\b",
235+
"name": "constant.language.pine"
236+
},
237+
{
238+
"match": "\\bstrategy\\.(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",
239+
"name": "constant.language.pine"
240+
},
241+
{
242+
"match": "\\bstrategy\\.commission\\.(cash_per_contract|cash_per_order|percent)\\b",
243+
"name": "constant.language.pine"
244+
},
245+
{
246+
"match": "\\bstrategy\\.direction\\.(all|long|short)\\b",
247+
"name": "constant.language.pine"
248+
},
249+
{
250+
"match": "\\bstrategy\\.max_contracts_held_(all|long|short)\\b",
251+
"name": "constant.language.pine"
252+
},
253+
{
254+
"match": "\\bstrategy\\.oca\\.(cancel|none|reduce)\\b",
255+
"name": "constant.language.pine"
256+
},
257+
{
258+
"match": "\\btext\\.align_(center|left|right)\\b",
259+
"name": "constant.language.pine"
260+
},
261+
{
262+
"match": "\\bxloc\\.(bar_index|bar_time)\\b",
123263
"name": "constant.language.pine"
124264
},
125265
{
126-
"match": "\\b(aqua|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|orange)\\b",
266+
"match": "\\byloc\\.(abovebar|belowbar|price)\\b",
127267
"name": "constant.language.pine"
128268
},
129269
{

0 commit comments

Comments
 (0)