Pine Indicator & Strategy Builder | TradingView v6

    1

    Build complete Pine v6 indicators and strategies with explicit signal timing, risk boundaries, worked examples and a validation handoff.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Pine Indicator & Strategy Builder | TradingView v6

    Example session with this skill installed

    Use Pine Indicator & Strategy Builder to deliver complete Pine v6 indicator and strategy source for an educational BATS:AAPL H1 standard-candle example. LONG when a completed close is strictly above the prior three completed candles' highest high; SHORT below their lowest low. Exclude the signal candle; equality means NONE. Keep raw markers while occupied. Fixed quantity 1 chart unit, flat-only entries, ignore opposite signals while occupied, no reversal or pyramiding. SL10ticks and TP20ticks anchored to actual simulated entry. USD10000 capital, 0.01% commission, 2ticks slippage, 100% margin. Bar-close calculations with next-available-tick fills; no on-close, every-tick or order-fill recalculation. No session/news/MTF filters. Invalid OHLC and warmup must not produce events. Include all code, setup, deterministic fixtures and an honest check ledger. Do not access accounts, compile natively, create alerts, publish or trade.

    • Read your context and instructions
    • Compiled the pine indicator
    • Generated the data export

    AAPL H1 three-bar breakout — complete buyer deliverable v1.1.0-bats

    Built two complete Pine v6 scripts for the requested educational BATS:AAPL, 60-minute, standard-candle example. This delivery contains source and local mathematical/source checks. Subsequent separately versioned BATS native checks are recorded in the current ledger below; the original mathematical fixtures remain source-independent local evidence.

    Rule and execution contract

    At completed bar t, upper = highest high of bars t-3, t-2 and t-1; lower = lowest low of those bars. LONG requires close[t] strictly greater than upper. SHORT requires close[t] strictly less than lower. Equality gives NONE. The signal candle's high/low are excluded. Four valid candles are required, including the signal candle. Missing/nonfinite/nonpositive prices and impossible OHLC invalidate the entire window; a numerical sanity bound rejects prices at or above 1e100, far outside AAPL's intended scope.

    Both scripts calculate the same raw event on every bar and expose it in Data Window. Developing candles create no confirmed event. Channels use completed prior bars. The scripts reject a different provider/symbol, a different timeframe and nonstandard chart OHLC. Use the normal Candles chart style; standard-chart detection also recognizes other visual styles that share actual OHLC.

    The strategy requests exactly one chart unit (one share in this AAPL example). Entries require a flat position and no open strategy trade; an occupied strategy ignores either raw direction while retaining its marker. No reversal, pyramiding, averaging, grid or martingale occurs. It submits the market entry and its protective bracket together. Relative loss=10 and profit=20 mean tick distances from the actual simulated entry fill, not absolute prices or points. With a 0.01 tick, those distances are 0.10 and 0.20; use the actual syminfo.mintick.

    Strategy calculation occurs at bar close. The market order becomes fillable on the next available emulator tick, usually the next bar's open. On-close order processing, every-tick calculation and order-fill recalculation are explicitly false. Existing brackets remain unchanged until exit. Gap handling and same-bar SL/TP sequencing depend on emulator assumptions; fixed distances do not guarantee maximum realized loss. Margin can reject an order even when a signal and entry intent exist.

    No session/news/MTF filter is added. The selected chart's available regular/extended-session candles define the data; record that setting. No signal, order or delivery is claimed from a historical marker alone.

    Raw event versus entry decision

    Completed-bar caseRaw marker / directionStrategy action
    Valid strict upper breakout, flatL / +1Submit LONG and its initial bracket
    Valid strict lower breakout, flatS / -1Submit SHORT and its initial bracket
    Equality at either boundaryNone / 0None
    Position open, either raw breakoutPreserve L or SNone; keep existing bracket
    Warmup, invalid OHLC or developing candleNone / 0None
    Entry intent exists but margin rejects itPreserve L or SNo guaranteed fill; inspect native report

    Complete indicator source

    Save as AaplThreeBar.indicator.pine:

    //@version=6
    indicator("BATS AAPL H1 Three-Bar Breakout | Indicator v1.1.0-bats", overlay=true, max_bars_back=10)
    
    f_validPrice(float value) =>
        not na(value) and value > 0.0 and value < 1e100
    
    f_validBar(float openPrice, float highPrice, float lowPrice, float closePrice) =>
        f_validPrice(openPrice) and f_validPrice(highPrice) and f_validPrice(lowPrice) and f_validPrice(closePrice) and highPrice >= math.max(openPrice, closePrice) and lowPrice <= math.min(openPrice, closePrice) and highPrice >= lowPrice
    
    f_rawSignal() =>
        float upperBound = ta.highest(high[1], 3)
        float lowerBound = ta.lowest(low[1], 3)
        float invalidWindow = ta.highest(f_validBar(open, high, low, close) ? 0.0 : 1.0, 4)
        bool ready = bar_index >= 3 and invalidWindow == 0.0 and f_validPrice(upperBound) and f_validPrice(lowerBound)
        int direction = ready and barstate.isconfirmed ? close > upperBound ? 1 : close < lowerBound ? -1 : 0 : 0
        [upperBound, lowerBound, direction, ready]
    
    if barstate.isfirst and (not chart.is_standard or timeframe.period != "60" or syminfo.prefix != "BATS" or syminfo.ticker != "AAPL")
        runtime.error("This educational example requires BATS:AAPL, H1 (60 minutes), and standard OHLC candles.")
    
    [upperBound, lowerBound, rawDirection, ready] = f_rawSignal()
    plot(ready ? upperBound : na, "Prior three-bar high", color=color.blue)
    plot(ready ? lowerBound : na, "Prior three-bar low", color=color.orange)
    plotshape(rawDirection == 1, title="Raw LONG", style=shape.triangleup, location=location.belowbar, color=color.blue, text="L", textcolor=chart.fg_color, size=size.small)
    plotshape(rawDirection == -1, title="Raw SHORT", style=shape.triangledown, location=location.abovebar, color=color.orange, text="S", textcolor=chart.fg_color, size=size.small)
    plot(rawDirection, "Raw signal direction", display=display.data_window)
    plot(ready ? 1 : 0, "OHLC and warmup ready", display=display.data_window)
    

    Complete strategy source

    Save as AaplThreeBar.strategy.pine:

    //@version=6
    strategy("BATS AAPL H1 Three-Bar Breakout | Strategy v1.1.0-bats", overlay=true, max_bars_back=10, initial_capital=10000, currency=currency.USD, default_qty_type=strategy.fixed, default_qty_value=1, pyramiding=0, commission_type=strategy.commission.percent, commission_value=0.01, slippage=2, margin_long=100, margin_short=100, calc_on_every_tick=false, calc_on_order_fills=false, process_orders_on_close=false)
    
    f_validPrice(float value) =>
        not na(value) and value > 0.0 and value < 1e100
    
    f_validBar(float openPrice, float highPrice, float lowPrice, float closePrice) =>
        f_validPrice(openPrice) and f_validPrice(highPrice) and f_validPrice(lowPrice) and f_validPrice(closePrice) and highPrice >= math.max(openPrice, closePrice) and lowPrice <= math.min(openPrice, closePrice) and highPrice >= lowPrice
    
    f_rawSignal() =>
        float upperBound = ta.highest(high[1], 3)
        float lowerBound = ta.lowest(low[1], 3)
        float invalidWindow = ta.highest(f_validBar(open, high, low, close) ? 0.0 : 1.0, 4)
        bool ready = bar_index >= 3 and invalidWindow == 0.0 and f_validPrice(upperBound) and f_validPrice(lowerBound)
        int direction = ready and barstate.isconfirmed ? close > upperBound ? 1 : close < lowerBound ? -1 : 0 : 0
        [upperBound, lowerBound, direction, ready]
    
    if barstate.isfirst and (not chart.is_standard or timeframe.period != "60" or syminfo.prefix != "BATS" or syminfo.ticker != "AAPL")
        runtime.error("This educational example requires BATS:AAPL, H1 (60 minutes), and standard OHLC candles.")
    
    [upperBound, lowerBound, rawDirection, ready] = f_rawSignal()
    bool flat = strategy.position_size == 0 and strategy.opentrades == 0
    bool longIntent = flat and rawDirection == 1
    bool shortIntent = flat and rawDirection == -1
    
    if longIntent
        strategy.entry("LONG", strategy.long, qty=1)
        strategy.exit("LONG EXIT", from_entry="LONG", loss=10, profit=20)
    else if shortIntent
        strategy.entry("SHORT", strategy.short, qty=1)
        strategy.exit("SHORT EXIT", from_entry="SHORT", loss=10, profit=20)
    
    plot(ready ? upperBound : na, "Prior three-bar high", color=color.blue)
    plot(ready ? lowerBound : na, "Prior three-bar low", color=color.orange)
    plotshape(rawDirection == 1, title="Raw LONG", style=shape.triangleup, location=location.belowbar, color=color.blue, text="L", textcolor=chart.fg_color, size=size.small)
    plotshape(rawDirection == -1, title="Raw SHORT", style=shape.triangledown, location=location.abovebar, color=color.orange, text="S", textcolor=chart.fg_color, size=size.small)
    plot(rawDirection, "Raw signal direction", display=display.data_window)
    plot(longIntent ? 1 : shortIntent ? -1 : 0, "Entry intent direction", display=display.data_window)
    plot(ready ? 1 : 0, "OHLC and warmup ready", display=display.data_window)
    

    Setup and Properties

    1. In TradingView, select BATS:AAPL, timeframe 60 minutes and standard Candles. For a reproducible first native check, use the regular trading-session dataset and record adjustment settings, timezone, date window and whether the feed is realtime/delayed. No chart session is forced by source.
    2. Create a new indicator, paste its complete source, save as BATS AAPL H1 Three-Bar Breakout | Indicator v1.1.0-bats, then compile and add only in an authorized testing layout. Check the saved My scripts name separately from the editor text.
    3. Create the strategy from its complete source and save as BATS AAPL H1 Three-Bar Breakout | Strategy v1.1.0-bats. Match source hashes to the ledger before recording native results. No code inputs require setting: the requested rules are fixed constants.
    4. Freeze strategy Properties: initial capital USD 10,000; fixed quantity one chart unit (entry commands explicitly use qty=1); commission 0.01% per transaction; slippage two ticks; long and short margin 100%; pyramiding zero. Disable On Every Tick, After Order Is Filled and On Bar Close order processing. Leave Bar Magnifier off for this initial baseline and record any later change as a separate experiment. Changes through the UI can override defaults and require new evidence.
    5. Compare both scripts' Data Window raw direction at identical completed timestamps. Strategy native fill markers are not the parity target: entry intent and fills have different timing and vetoes.
    6. Inspect native long/short trade entry prices and quantities, 10-tick/20-tick brackets, costs, margin rejections and gap/ambiguous-bar behavior. Export the trade list and report with Properties. Subsequent bounded quantity/bracket/cost checks are recorded below; exhaustive margin/gap cases remain untested.
    7. After source/input/symbol/timeframe changes, any later owner-authorized saved alert snapshot must be recreated and reverified. These scripts do not create alerts or send webhooks; alert setup and delivery were outside this trial.

    Deterministic fixture expectations and observed scope

    All cases below are independent synthetic alternatives, not a chronological backtest. Prior bars are OHLC (100,101,99,100), (100,102,98,100), (100,103,97,100), so upper=103 and lower=97.

    CaseSignal OHLC / stateExpected raw / entry
    Positive LONG, current-high exclusion(102,104,101,103.5), flat+1 / +1
    Positive SHORT(98,99,96,96.5), flat-1 / -1
    Upper equality boundary(102,104,101,103), flat0 / 0
    Lower equality boundary(98,99,96,97), flat0 / 0
    Inside range(100,102,99,101), flat0 / 0
    WarmupOnly two prior bars0 / 0
    Impossible current OHLC(102,103,101,104)0 / 0
    Invalid prior OHLCFirst prior open=102 exceeds its high=1010 / 0
    Missing closeclose=None0 / 0
    Nonfinite highhigh=inf or NaN0 / 0
    Nonpositive lowlow=00 / 0
    Occupied LONG, raw SHORTSHORT fixture, occupied-1 / 0
    Occupied SHORT, raw LONGLONG fixture, occupied+1 / 0
    Developing candleLONG fixture, unconfirmed0 / 0
    Constant zero-range candlesAll four bars (100,100,100,100)0 / 0

    Two additional arithmetic fixtures check fill-anchored brackets and per-transaction fees. For tick 0.01, LONG fill104 -> SL103.90/TP104.20; SHORT fill96 -> SL96.10/TP95.80. One share entering100 and exiting100.20 has round-trip fee0.02002 at 0.01% per transaction, before other costs.

    Observed result: all 17 Python mathematical/state fixture tests passed. Four additional static checks passed: identical signal function block, requested execution-setting literals, flat-entry/relative-bracket source configuration, and absence of MTF requests. These checks do not execute Pine. The independent Python oracle verifies expected mathematics/state transitions, not TradingView behavior. Static source checks verify those source properties only.

    Reproduce from the workspace root

    python agensi-skills/qa/pine-builder-trial/verify_trial.py
    

    Artifacts: verify_trial.py, local-checks.txt and check-ledger.json beside the two Pine files.

    Current native validation ledger - 2026-10-21 UTC

    This BATS v1.1.0-bats variant was explicitly approved as a separate feed contract, not a silent NASDAQ substitution. Only provider guard, context text and names/version changed. Original NASDAQ v1.0.0 source/evidence remains preserved separately.

    CheckActual result
    Both native compilations and chart runtimePASS, privately saved and added; no compiler diagnostic observed.
    Saved versions and PropertiesPASS, both restored after reload; requested USD10000/qty1/0.01% commission/2tick slippage/100% margin/pyramiding0/bar-close/next-tick settings preserved.
    Completed same-feed signalsPASS, 297 independently reconstructed candles: 46 LONG, 46 SHORT, 205 NONE; both scripts match on the 300-row export.
    Reload overlapPASS, 300 identical overlapping OHLC/signal rows.
    Bounded replay overlapPASS, 286 completed overlapping rows. Developing replay candle indicator direction0, strategy not yet recalculated; no live realtime certification.
    Quantity and bounded bracket/cost examplesPASS, qty1 in11650 native entry/exit records (5825 trades); four observed long/short target/stop examples reconcile including slippage and rounded commission. Not exhaustive gap/fill-engine validation.
    Illustrative report, Jan2 2015-Oct20 20265825 trades, net-266.56USD, maxDD267.19USD, win31.50%, PF0.549. Not profitable and not a frozen holdout or forward test.
    Live realtime / alerts / webhooks / broker tradingNOT_RUN; no such actions.
    Marketplace output rightsClarified by Agensi support on2026-10-21: independent buyer-generated source can be retained/edited/compiled/used/distributed; protected package/examples and substantial example copies must not be exported as standalone files. This demonstration is not an unrestricted licence to export bundled source.
    Marketplace supporting-file deliveryAgensi confirms relative .md/.pine/.json runtime retrieval. Basic authenticated connector account reads PASS. Unpublished paid drafts cannot be tested through the live connector; local compatible-agent/package evidence is the pre-submission method. Exact live buyer delivery remains NOT_RUN, not retroactively PASS.

    Indicator SHA256: a31334bad00050ff6280fae270bd8d7b985c0e4abcd913a59acf89cd8028e4c3

    Strategy SHA256: 0165dc0ed3551a7d7fbf8587610c4e59d5b636386fcd8989bfc20fcd82291106

    Local fixtures are not Pine execution; native CSV checks cover their stated window, not all historical signals. Alternative Cboe/BATS data is not primary NASDAQ data. No universal non-repainting, profitable-performance or live-readiness claim. These are educational reference scripts and an AI-assistant workflow, not a trading recommendation.

    pine-indicator-strategy-builder-tradingv.csv

    CSV · data export

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    From trading rules to complete Pine source

    Pine Indicator & Strategy Builder guides your AI assistant through implementing indicators, strategies, indicator-to-strategy conversions and bounded repairs in Pine Script v6.

    What you receive

    • A clear rule and timing contract before dependent code is accepted.
    • Complete source with raw signals separated from entry eligibility, simulated fills and risk vetoes.
    • Explicit quantity, protection, commission, slippage and recalculation decisions for strategy work.
    • Positive, negative and boundary fixtures plus an honest check ledger.
    • Installation, settings and native validation instructions.

    Included resources

    Eight source/text files: SKILL.md, README, timing notes, validation protocol, an original reference contract, complete Donchian indicator and strategy examples, and synthetic signal fixtures. Examples illustrate engineering choices, not a recommended or profitable strategy. Your requested rules and risk remain authoritative.

    What the $9 purchase is for

    A one-time AI-assistant workflow and supporting examples, not unlimited bespoke coding, a hosted compiler, market data or account management. Agensi delivers the package only through its connected agent; buyers do not download the skill ZIP. Independently generated Pine code for a buyer's own request may be retained, edited, compiled, used and distributed. The uploaded instructions, references and bundled examples remain protected skill material; substantial copies of example code must not be redistributed as standalone exports.

    Honest limits

    No guaranteed profitable, non-repainting or live-ready output. A generated script needs its own native compile/chart/reload/replay checks. No martingale, grid, averaging or pyramiding. No broker connection, orders, alerts, webhooks or publication are authorized. Native tools and TradingView access are not included. A live buyer-host test is separate from local package validation. Agensi confirms unpublished paid drafts cannot be tested through its live connector before review/publication; the pre-submission evidence is local compatible-agent authoring, package checks and the bounded native demo checks, not a live marketplace delivery pass.

    Runtime file manifest (v1.0.1)

    • SKILL.md: workflow, output-rights and authority boundaries.
    • README.md: runtime requirements, exact file manifest and expected output.
    • references/timing-and-execution.md: causal signal timing, simulated execution and protection decisions.
    • references/validation-protocol.md: fixtures, native checks and evidence labels.
    • examples/REFERENCE-CONTRACT.md: assumptions behind the original reference pair.
    • examples/DonchianReference.indicator.pine: optional in-session indicator engineering reference.
    • examples/DonchianReference.strategy.pine: optional in-session strategy/risk reference.
    • examples/fixtures.json: synthetic raw-event expectations, not market-performance results. Load relevant supporting files through the connector's file index/relative-file parameter; do not assume they exist on disk. Expected output is a user-specific rule contract, complete independently implemented Pine source, setup/Properties, fixtures and an honest check ledger. If a supporting file is unavailable, disclose it rather than claiming it was read.

    Demo/testing only

    Use generated indicators and strategies only for demonstration, research and paper/testing workflows under this release. Strategy rules and risk remain unchanged. No broker orders, alerts, webhooks, live-capital use or automated publication are authorized. Historical native demo evidence does not establish live readiness.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.

    AI-assistant workflow, not a compiler, data service or profitable trading system. Separately versioned BATS:AAPL v1.1.0-bats demo compiled and ran privately in TradingView with unchanged rules/risk: 297 completed-candle oracle checks, 300-row reload overlap and 286-row bounded replay overlap passed. Fixed qty1 verified across 11650 entry/exit records; four bracket/cost examples reconciled. Native illustrative report lost USD266.56 across5825 trades; no profitable-edge, universal non-repainting or live-readiness claim. Primary NASDAQ v1.0.0 remains blocked on this alternative feed. Live realtime, full gap/fault cases and multi-host buyer delivery remain unverified. Agensi clarified on 2026-10-21: independently generated buyer code may be retained/edited/compiled/used/distributed; the skill package and substantial example copies must not be exported as standalone files. Supporting files are read by the connected agent at runtime. Unpublished paid drafts cannot be live-connector-tested before review/publication; local compatible-agent testing is the pre-submission method, not live delivery certification. No broker orders, alerts or webhooks.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 27 days ago

    Nothing to install. It runs in your AI agent.

    Optional
    Web browsingTradingView Pine Editor

    The Pine Editor and TradingView charts are only for separately authorized native validation; they are not bundled.

    Permissions

    Read Files
    Write Files
    Browser
    Network Access

    Optional file reads: user-authorized source and packaged references; writes: user-chosen independently generated output only, not the protected skill package or bundled examples. Optional browser/network: public official documentation. Connected-account chart/editor use needs separate authorization. No credentials, environment variables, broker execution, alerts, webhooks, spending or publication permission is granted.

    Listed27 days ago

    What's inside

    Frequently Asked Questions

    No. It supplies AI-assistant instructions and source examples. TradingView access, native compilation, alerts and broker execution are not included or automatically authorized.

    No. Every generated or modified script needs its own version-bound native compile and behavior checks. The workflow separates completed and developing events and reports unrun checks; it does not guarantee universal non-repainting or profitability.

    That is the intended workflow: preserve the raw event contract, then specify sizing, entries, protection and simulated fills separately. Ambiguous rules remain explicit blockers rather than invented defaults.

    Independently generated Pine code for your own request may be retained, edited, compiled, used and distributed. The skill ZIP, instructions, references and bundled examples are agent-loaded material, not buyer downloads. Outputs substantially reproducing bundled example code must not be redistributed as standalone exports.

    New in Trading & Investing