Supported Pine Script features
What the Pine to strategy converter understands today, and what it will tell you it cannot do.
The converter is a real Pine parser and code generator that runs in your browser. Anything it cannot convert is reported with a line number instead of being guessed. To try a script, open the backtester.
Language features
- Pine v4, v5 and v6 syntax, including v3-style boolean directions
- var and varip variables, := reassignment and compound assignment
- if / else if / else, switch, for, for-in and while, also as expressions
- User-defined functions with default and typed parameters
- Tuples such as [macd, signal, hist] = ta.macd(...)
- History references such as close[1], x[2] and (a + b)[1]
- input.int, input.float, input.bool, input.string and input.source become editable settings
- request.security on the chart symbol, non-repainting by default
- Indicator-only scripts that use alertcondition or plotshape with buy and sell signals
- Indicators that track their own trades with flags such as call_active / put_active: the trade opens and closes with the flag
- Drawing calls (line.new, label.new, box.new, table.new) are skipped but return a handle, so guards like not na(line) still work
Indicators (ta.*)
Moving averages, oscillators, volatility, channels, pivots and crossover detection. Legacy v4 names such as sma() and crossover() also work.
ta.almata.atrta.barssinceta.bbta.bbwta.ccita.changeta.cmota.correlationta.crossta.crossoverta.crossunderta.cumta.devta.dmita.emata.fallingta.highestta.highestbarsta.hmata.kcta.linregta.lowestta.lowestbarsta.macdta.maxta.medianta.mfita.minta.momta.percentrankta.pivothighta.pivotlowta.rangeta.risingta.rmata.rocta.rsita.sarta.smata.stdevta.stochta.supertrendta.swmata.trta.valuewhenta.varianceta.vwapta.vwmata.wmata.wpr
Strategy orders (strategy.*)
Entries, exits with stop, limit, tick-based profit and loss and trailing stops, closes and cancels. Order size comes from the Size settings.
strategy.cancelstrategy.cancel_allstrategy.closestrategy.close_allstrategy.entrystrategy.exitstrategy.order
Math (math.*)
Arithmetic, rounding, powers, logarithms and trigonometry.
math.absmath.acosmath.asinmath.atanmath.avgmath.ceilmath.cosmath.expmath.floormath.logmath.log10math.maxmath.minmath.powmath.randommath.roundmath.round_to_mintickmath.signmath.sinmath.sqrtmath.summath.tanmath.todegreesmath.toradians
Arrays (array.*)
Creating, reading, updating, sorting and summarising arrays.
array.avgarray.cleararray.concatarray.copyarray.fillarray.firstarray.fromarray.getarray.includesarray.indexofarray.insertarray.joinarray.lastarray.maxarray.medianarray.minarray.newarray.new_boolarray.new_floatarray.new_intarray.new_stringarray.poparray.pusharray.removearray.reversearray.setarray.shiftarray.sizearray.slicearray.sortarray.stdevarray.sumarray.unshift
Time and sessions
Session filters with time(timeframe.period, "0915-1530"), timeframe.change and date parts.
dayofmonthdayofweekhourminutemonthsecondtimetimeframe.changetimeframe.in_secondstimestampyear
Utility
na handling, casts and basic string helpers.
boolcolor.newcolor.rgbfixnanfloatintnanzstr.containsstr.lengthstr.lowerstr.tonumberstr.tostringstr.upper
Skipped because they do not affect trades
These are parsed and ignored:
plotplotshapeplotcharplotcandlebgcolorbarcolorhlinefilllabel.*line.*box.*table.*alertalertcondition
Not supported
- Other symbols in request.security or ticker.*: only the uploaded data is loaded
- Maps, matrices, user-defined types, methods and imported libraries
- Per-trade queries such as strategy.opentrades.entry_price()
- Partial exits (qty and qty_percent) and percent-of-equity order sizing
- Real-time-only features: calc_on_every_tick and varip behaviour differ from live charts
Missing something you need? Tell us.
