FRACTALSCRIPT

The Advanced Algorithmic Intelligence

ENGINE V5.0 CORE • MULTI-PHASE ARCHITECTURE COMPLETE

← RETURN TO CORE TERMINAL

AI Co-Pilot

Natural language generation and automated logic fixing powered by deep intelligence.

🧬

Matrix Algebra

High-speed linear calculations for complex correlation and statistical models.

🛰️

Auto-MTF

Built-in candle aggregator for true Multi-Timeframe analysis on any data stream.

Bot Engine

Full strategy support with backtesting, equity curves, and trade introspection.

AI Intelligence

FRACTAL AI PRO

The Intelligence Layer

FractalScript is the first engine to integrate a native AI Code Generator and Fixer. Describe your strategy in English, and the engine generates valid Pine v5 logic instantly. Encounter an error? The AI Fixer analyzes the AST (Abstract Syntax Tree) to repair broken logic in real-time.

ai.generate(prompt)
ai.fix(broken_code)
ai.analyze(ast_node)

The Matrix Engine

Unlock institutional-grade mathematics. The Matrix Engine supports multi-dimensional arrays for calculating covariance, eigenvalues, and complex price grids that are impossible with standard variables.

    matrix.new<float>(rows, cols)
    matrix.set(m, r, c, val)
    matrix.get(m, r, c)
    matrix.add(m1, m2)
m = matrix.new(2, 2, 0.0) matrix.set(m, 0, 0, close) matrix.set(m, 1, 1, close[1]) // Perform linear calculations avg = matrix.avg(m) plot(avg, color=color.aqua)

Algorithmic Strategy

Transform your indicators into automated bots. The Strategy Engine tracks every trade, manages positions, and generates professional equity metrics directly in the terminal.

🎯 Position Tracking

Live introspection of entry price, profit, and trade duration using the strategy.opentrades suite.

🛡️ Risk Management

Support for exact limit and stop price exits, allowing for professional bracket orders.

📊 Performance Logs

Automated calculation of Win Rate, Net Profit, and Max Drawdown on every execution.

The Autonomous Bracket Bot

Positional Price Exits
//@version=5 strategy("Bracket Bot", overlay=true) // Entry on Golden Cross if ta.crossover(ta.ema(close, 9), ta.ema(close, 21)) strategy.entry("Long", strategy.long) // Manage the trade using introspection if strategy.opentrades > 0 entry = strategy.opentrades.entry_price(0) // Exit at exactly +$10 TP or -$5 SL strategy.exit("Exit", "Long", limit=entry + 10, stop=entry - 5)

Multi-Timeframe Analysis

// Fetch RSI from the 1-hour timeframe // while trading on the 5-minute chart hrRsi = request.security("", "60", ta.rsi(close, 14)) plot(hrRsi, color=color.new(color.gold, 50))

Institutional Aggregation

The Inception Auto-Aggregator allows you to call request.security with zero configuration. It builds a virtual higher-timeframe history on the fly, evaluates your indicators in isolation, and maps the results back to your current timeline.

Standard Library

ta.sma / ema / rma / wma
ta.rsi / stoch / macd
ta.atr / vwap / bbands
ta.crossover / crossunder
label.new / set_text / delete
line.new / set_xy1 / delete
matrix.new / set / get
strategy.entry / exit / close
request.security (Auto-Agg)
str.tostring / lower / upper
math.abs / round / sqrt
na / isNa / nz