FactorLang Expression for Openclaw

FactorLang is a specialized expression language designed for building and executing quantitative trading factors and strategy logic.

rxjhfmf
v1.0.1
Mar 27, 2026
0
736
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install factorlang-expression

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install factorlang-expression using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is FactorLang Expression?

FactorLang is a robust domain-specific language (DSL) tailored for the financial sector, specifically for quantitative analysis and algorithmic trading. It allows developers and traders to define complex market conditions, technical indicators, and risk management rules using a concise syntax. By providing a structured way to reference market data and technical signals across various timeframes, FactorLang empowers users to bridge the gap between financial theory and automated execution.

This skill provides the comprehensive specification for FactorLang v2.2, serving as a technical bridge for AI agents to generate syntactically correct and logically sound trading expressions. It encompasses a vast library of built-in variables, statistical functions, and logical operators essential for modern strategy backtesting and live trading deployments within the Openclaw Skills ecosystem.

FactorLang Expression Use Cases

  • Creating custom technical indicators like moving average crossovers or RSI overbought/oversold signals.
  • Developing automated breakout strategies based on price action and box theory.
  • Implementing precise risk management rules including point-based or percentage-based stop-loss and take-profit conditions.
  • Performing multi-period market analysis by combining data from different timeframes such as 5-minute and daily charts.
  • Validating quantitative trading hypotheses through standardized expression syntax.

How FactorLang Expression Works

  1. The user defines a trading intent or logic (e.g., 'breakout above the 10-day high').
  2. The skill identifies the appropriate FactorLang variables such as _close_1d and functions like HHV.
  3. The expression is constructed following strict period and parameter rules (e.g., HHV(10, _close_1d, 1d, 1ref)).
  4. Logical operators (&&, ||) are applied to combine multiple conditions into a single strategy factor.
  5. The finalized FactorLang string is passed to an execution engine or MCP server for backtesting or live monitoring.

FactorLang Expression Setup

To utilize FactorLang expressions within your development environment, ensure your AI agent has access to the Openclaw Skills configuration. No local installation of the language is required as it is interpreted by the target trading engine.

# Example of how an agent might trigger a FactorLang expression via MCP
mcp_call factorlang-engine run_expression --openCondition "_close_5m > _ma_1d_30"

FactorLang Expression Data Schema & Taxonomy

FactorLang organizes data through a strict naming convention for variables and function signatures to ensure cross-compatibility.

Core Variable Taxonomy

Category Format Description
Market Data _{type}_{period} Basic price/volume data (e.g., _close_1d)
Indicators _{name}_{period}_{param} Technical studies (e.g., _ma_1d_30)
PnL Tracking _palp / _palr Profit/Loss in points or ratios

Supported Timeframes

  • High Frequency: 1m, 5m
  • Short/Medium Term: 15m, 30m, 60m
  • Long Term: 1d, 1w, 1mon

FactorLang Expression Advanced Features

  • Multi-period inference: Automatically deduces the correct closing price period based on the base strategy timeframe.
  • Double Box Logic: Advanced support for calculating maximums and minimums across current and previous price 'boxes'.
  • MCP Server Integration: Standardized rules for calling external execution engines with dynamic stop conditions.
  • Statistical Aggregators: Built-in support for HHV (Highest High Value), LLV (Lowest Low Value), and SUM functions over sliding windows.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*