Pine Script compatibility
Check supported Pine versions, functions and execution behavior before moving a strategy into QTrader.
Before you start
QTrader runs a supported subset of Pine Script, translated into its restricted Python strategy runtime. Pine v4, v5 and v6 markers are accepted; changing the marker does not make an unsupported feature work. Start with a strategy, not an indicator, if you want simulated orders. The complete compatibility table distinguishes supported behavior, ignored calls and explicit errors.
Follow the workflow
- Compile the original script and read both errors and Notes. Keep the first failing line and a copy of the original code.
- Reduce the script to the smallest expression or order that reproduces the issue. Check the exact function and its arguments in the compatibility table.
- Treat ignored drawing, alert or risk calls as missing behavior, even if compilation succeeds. Do not assume an ignored risk control protects a backtest or a real account.
- Compare order timing, quantity, market and costs before comparing a result with TradingView. See fill rules.
Worked example
The bundled SMA strategy uses supported inputs, moving averages and crossing conditions. It provides a known starting point before you add a feature from your own script.
//@version=6
strategy("SMA 50/200 cross", initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1)
fastLength = input.int(50, "Fast SMA", minval=2)
slowLength = input.int(200, "Slow SMA", minval=2)
fast = ta.sma(close, fastLength)
slow = ta.sma(close, slowLength)
if ta.crossover(fast, slow)
strategy.entry("Long", strategy.long)
if ta.crossunder(fast, slow)
strategy.close("Long")
Limits and interpretation
Imports, unsupported chart types and lower-timeframe security requests are examples of features that need checking rather than silent substitution. Some higher-timeframe requests are supported with documented restrictions. This is compatibility with selected behavior, not complete TradingView parity. Recheck the table when changing the engine version or order-processing options.