Pine Converter

Convert Pine Script into reviewed Python strategy packages.

Paste your Pine logic, let Stockey extract rules and assumptions, review the generated StrategySchema, run historical backtests with your own broker data access, and export a self-hosted Python package.

Pine Script input
> strategy(...)> emaFast = ta.ema(close, 20)> emaSlow = ta.ema(close, 50)> longCondition = ta.crossover(emaFast, emaSlow)> exitCondition = ta.crossunder(emaFast, emaSlow)
Extraction review
Inputs detected2
IndicatorsEMA fast, EMA slow
Entry rulecrossover condition
Exit rulecrossunder condition
Timeframeneeds confirmation
Risk rulesmissing
Broker segmentneeds selection
Repainting riskreview required
StrategySchema preview
strategy_category: "trend_following"source_type: "pine_import"entry_rules: "review_required"exit_rules: "review_required"risk_controls: "missing"backtest_source: "broker_historical_or_csv"live_mode: "self_hosted_disabled_by_default"
Assumptions detectedRisk rules missingBroker data requiredPython package draftHuman review required

Pine conversion is not copy-paste automation. It is a review workflow.

Pine scripts often contain assumptions about timeframe, repainting, request.security calls, entry timing, order behavior, and missing risk controls. Stockey turns those assumptions into reviewable fields before generating code.

Rule extraction

Detect indicators, inputs, entry conditions, exit conditions, and strategy calls.

Assumption detection

Flag missing timeframe, segment, broker, risk, sizing, and data-source details.

Repainting review

Highlight logic that may behave differently in historical and self-hosted evaluation.

StrategySchema conversion

Normalize extracted rules into a structured, versioned strategy contract.

Python package generation

Generate strategy-specific code, configs, docs, and backtest entrypoints.

Human approval

Require user review before backtesting, package baking, or self-hosted deployment.

From Pine logic to self-hosted Python package.

Every stage keeps extracted rules, assumptions, data source, and package readiness visible before export.

Paste Pine

paste strategy or indicator logic

Extract Rules

detect indicators, entries, exits, and inputs

Review Assumptions

confirm missing risk, broker, timeframe, and segment details

Build StrategySchema

create a structured Stockey strategy contract

Run Historical Backtest

use broker historical data or CSV selected by the user

AI Analysis

review drawdowns, data gaps, rule behavior, and improvement ideas

Bake Package

export Python scripts, configs, and deployment docs

What Stockey can extract from Pine logic.

The converter creates a structured review draft; it does not claim perfect compatibility or skip human checks.

Inputs and parameters

Extract configurable variables and default values.

Indicators

Identify common moving averages, RSI, MACD, ATR, volume, and condition logic.

Entry and exit conditions

Detect crossover, crossunder, threshold, time, and condition rules.

Strategy calls

Map strategy-style calls into structured order-intent logic for review.

Alerts and webhooks

Convert alert-style logic into package configuration notes.

Visual plots

Use plots as explanation context, not as execution rules unless confirmed.

Some Pine logic must be confirmed before code generation.

Review-required items stay visible until the user confirms what should become part of the StrategySchema.

Review required

  • request.security / multi-timeframe logic
  • repainting-sensitive logic
  • intrabar assumptions
  • bar close vs real-time behavior
  • broker segment and lot size
  • stop loss and sizing rules
  • partial exits and re-entry logic
  • strategy pyramiding behavior

Not automatically assumed

  • runtime execution behavior
  • broker-specific order type
  • F&O expiry selection
  • options strike selection
  • MCX contract rollover
  • missing risk controls
  • missing capital allocation
  • missing transaction cost assumptions
Stockey does not silently invent missing trading logic. It asks the user to confirm assumptions before backtesting or export.

Review assumptions before testing.

Detected itemCurrent valueConfidenceRequired action
TimeframeNot specifiedLowSelect timeframe
SegmentNot specifiedLowChoose Equity, Futures, Options, or MCX
Risk ruleMissingHighAdd SL / target / kill switch
Entry ruleEMA crossoverMediumConfirm bar-close behavior
Exit ruleEMA crossunderMediumConfirm exit priority
Data sourceNot selectedHighChoose broker historical data or CSV
Runtime behaviorDisabledHighSelf-hosted only after export

Conversion readiness

Rules extracted68%
Risk controlsincomplete
Backtest readynot yet
Package readynot yet
Human reviewrequired

Test converted logic with your own historical data access.

After review, Stockey can run historical backtests using broker-provided historical data or user-uploaded CSVs. The available range depends on the broker, instrument, segment, and timeframe.

Backtest setup
Broker
user selected
Data source
broker historical / CSV
Segment
user selected
Instrument
user selected
Timeframe
user selected
Range
within available data window
Costs/slippage
configurable assumptions
Data gaps
detected and reported

Backtests are historical simulations. They do not predict future performance and are not investment advice.

AI analyzes the conversion and the backtest. It does not tell you what to trade.

AI analysis stays focused on strategy review, education, and user-selected experiments.

Conversion analysis

Explains extracted rules, missing assumptions, and translation risks.

Backtest analysis

Reviews drawdown, trade distribution, stop-loss behavior, exposure, and data limitations.

Improvement experiments

Suggests additional tests the user may choose to run, such as alternate exits, risk limits, or time filters.

AI analysis is for strategy review and education. It does not provide security recommendations, live trade instructions, or guaranteed results.

Every approved conversion leaves as an auditable package.

strategy_package/
strategy_package/
README.md
CONVERSION_NOTES.md
RISK_DISCLOSURE.md
.env.example
config/
strategy_config.yaml
broker_config.example.yaml
risk_config.yaml
pine_assumptions.yaml
src/
strategy.py
main_backtest.py
main_live.py
data/
broker_historical_fetch.py
csv_loader.py
backtest/
engine.py
metrics.py
reports.py
risk/
dry_run_guard.py
live_safety_gate.py
portfolio_risk.py
reports/
conversion_summary.md
backtest_summary.md
deployment/
BROKER_SETUP.md
LIVE_READINESS.md
RISK_DISCLOSURE.md

Safeguards

Pine assumptions documented
Missing logic flagged
Broker secrets excluded
Backtest data not permanently stored by default
Live mode disabled by default
User owns exported package
Self-hosted deployment only

Convert the script. Review the assumptions. Test before export.

Stockey turns Pine logic into a structured, reviewable Python strategy package — with historical backtesting and AI analysis before self-hosted deployment.