Pine Script indicator to strategy converter
Turn your Pine indicator into a strategy.
Paste open-source Pine v5 or v6. Get a v6 strategy() to paste into TradingView.
- Finds your entry signals
- Converts v5 to v6
- Stops, risk, daily-loss switch
Details: how it works, sources and FAQ
The answer
How do you turn a Pine Script indicator into a strategy?
Replace indicator() with strategy() and enter on the indicator's own true/false signals with strategy.entry(). ProEA's Pine Strategy Wrapper does both in your browser: paste an open-source Pine v5 or v6 indicator, pick its long and short signals, and copy a Pine v6 strategy whose calculations are left as written. Then compile it in TradingView's Pine Editor.
Method
What the wrapper changes in your script
Everything else stays byte for byte as you pasted it; our tests check that on every test indicator.
| Part of the script | What happens |
|---|---|
| Inputs, calculations, plots, alerts | Left exactly as written. alertcondition() calls stay: TradingView's Alerts page says they don't stop a strategy compiling, but alerts can't be created from them in a strategy. |
| indicator(…) | Becomes strategy(…) with every argument named (the two calls' positional orders part after scale). timeframe and timeframe_gaps are dropped, because strategy() has neither, and the page says so. Your capital, order size, commission and slippage are added. |
| A Pine v5 script | Goes through our v5 to v6 converter first. The page counts its edits and warns when a v6 behaviour change was left at v6's default for you to review. |
| The signals | Picked for you from titles and names (Buy, Sell, Long, Short, Bull, Bear…) among the plotshape(), plotchar(), alertcondition() and bool values at the script's top level; Adjust picks any other. A signal that can't be read twice safely gets a name on its own line above its call, and the call reads that name. The value doesn't change. |
| The end of the script | Two bool lines name your signals, then the entries: long when the long signal is true and the short isn't, short the other way round. strategy.entry() in the opposite direction reverses an open position (TradingView's Strategies page). One side only: the other signal closes it. |
All-Access
What the guardrails write into the strategy
Plain Pine you can read, each number an input in the strategy's settings. Built on our server from your settings; your script never leaves the browser.
| Guardrail | The Pine it uses |
|---|---|
| Stop-loss and take-profit | strategy.exit() with loss and profit in ticks, which TradingView's Strategies page documents as relative to the entry; the stop an ATR multiple or fixed ticks, the target a multiple of it. |
| Session filter | Entries only while time("", session, time zone) isn't na, the test TradingView's Sessions page gives; optionally flat outside the session. |
| Risk-% position size | Size = equity × risk% ÷ (stop distance × syminfo.pointvalue), rounded down to your quantity step. It assumes the account currency is the symbol's. |
| Daily-loss kill switch | At your limit the position is closed and no entry is taken until the next day: the symbol's trading day, or midnight in a time zone you pick (dayofmonth(time, zone), as on TradingView's Time page). The loss is read at each bar's close. It models your firm's rule; your firm's dashboard stays the source of truth. |
| Bar-close confirmation | Entries also need barstate.isconfirmed. Strategies calculate on bar close by default; this keeps entries there if you turn on recalculation on every tick. |
Method
How it works, and what it doesn't do
The script is read with the parser of our Pine v5 to v6 converter (a v5 script is converted first). The signals offered are the true/false values the indicator already makes at its top level: plotshape(), plotchar(), alertcondition() and bool variables. indicator() becomes strategy() (timeframe and timeframe_gaps, which strategy() doesn't have, are dropped and named) and a block at the end enters on the two signals you pick; a signal that can't be read again safely at the end is first given a name on the line above its call. Signals inside functions or if blocks and number-valued markers can't be picked, and a value whose type we can't confirm is flagged. Every output of our six test indicators, free and with each guardrail, compiled without errors on TradingView's compiler on 19 November 2026; your script isn't compiled here, so compile it in the Pine Editor. A backtest is not a forecast: commission and slippage start at zero until you set them, and the guardrails read equity at each bar's close.
The math: Long when the long signal is true and the short isn't, short the other way round · All-Access size = equity × risk% ÷ (stop ticks × syminfo.mintick × syminfo.pointvalue)
Your script never leaves your browser. For members, only the guardrail settings you pick are sent to our server, which writes the strategy code; nothing is stored. Your saved items stay in this browser. Updated 19 November 2026.
Questions
Common questions
Can it convert invite-only or protected TradingView indicators into strategies?
No. It needs the script's source code, and TradingView doesn't show the source of protected or invite-only scripts. Open-source scripts show their code under the chart on the script's page; copy that, or open the script in the Pine Editor, and paste it here.
Does wrapping change the indicator's calculations?
No. Only the declaration line changes, from indicator() to strategy(), and a block is added at the end that names your two signals and places the entries. When a signal can't be read again at the end with the same result (it calls request.security() or something that draws or changes a collection, or it reads a value the script changes later), it is first given a name on its own line above its call, and that call reads the name; its value is unchanged.
Does it work on Pine Script v4 or v5 indicators?
v5 scripts go through our v5 to v6 converter first, and the page says how many edits it made and whether any v6 behaviour change was left at v6's default for you to review. v4 and older aren't read: TradingView's Pine Editor can convert v4 scripts to v5 (its migration guide notes not every script converts), then paste the v5 code here.
Why can a converted strategy's backtest look better than live trading?
Commission and slippage start at zero until you set them in the strategy's properties. A higher-timeframe request.security() that reads a bar before it closes repaints on history; the page flags those and Pine Doctor fixes them. A signal drawn with a negative offset appears on an earlier bar than the one where it became true, while the strategy enters when it becomes true.
What does All-Access add to the strategy?
A stop-loss and take-profit on every entry through strategy.exit() (an ATR multiple or a fixed number of ticks, the target a multiple of the stop), a session filter in the time zone you pick, position size from a risk percentage of equity, a daily-loss kill switch that closes the position and stops entries for the day, entries only on a closed bar, and presets saved in this browser. Members' guardrail code is written on our server from your settings; your script never leaves the browser.
Will the strategy compile in TradingView?
Every output of our six test indicators, free and with each guardrail alone and together, compiled without errors on TradingView's compiler on 19 November 2026. Your own script isn't compiled here: paste the strategy into the Pine Editor and add it to the chart. If it reports an error, ProEA's Pine Doctor reads the script and points to the line.
Related