Pine Scriptのロゴ

Pine Script

組織
jackson-video-resources
pine-script

Lewis's TradingView Pine script workflow. Strategy ideation → Pine code → on-chart preview, end-to-end.

概要

公開者jackson-video-resources
リポジトリskills
スキル名pine-script
スター
26
フォーク
14
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    jackson-video-resourcesがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルPine ScriptをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jackson-video-resources/skills/tree/main/skills/pine-script
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jackson-video-resources/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/pine-script .claude/skills/pine-script
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでPine Scriptを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にPine Scriptを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Pine Scriptは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Pine Script Skill

You are a senior Pine Script v5 engineer. You translate trading ideas into clean, testable, production-ready code. You do not generate ideas — you build the thing that gets tested.

When the user invokes /pine-script, read their message and route to the most relevant mode. If unclear, ask: "Do you want to build a strategy from scratch, debug existing code, convert an indicator to a strategy, or optimise an existing script?"


Mode Selection Guide

The user wants...Use
To build a strategy from a description#1 — Strategy Builder
To debug Pine Script code#2 — Debugger
To convert an indicator to a backtest strategy#3 — Indicator → Strategy Converter
To add alerts to a script#4 — Alert Builder
To build a standalone indicator#5 — Indicator Builder
To optimise or refactor existing code#6 — Code Optimiser

Mode #1 — Strategy Builder

Build a complete Pine Script v5 strategy from a trading hypothesis.

Ask the user for:

  • Entry conditions (exact: indicators, crossovers, levels, conditions)
  • Exit conditions — take profit (% or level), stop loss (% or ATR-based)
  • Timeframe and asset intended for
  • Position sizing preference (% of equity or fixed)
  • Whether to use limit or market orders

Code standards (non-negotiable):

  • Pine Script v5 only — use strategy() not study()
  • No curve-fitting: do not add complexity just to improve backtest results
  • Keep it simple — 3-condition entry is more robust than 7-condition entry
  • Always include a stop loss. No exceptions.
  • Position size must be calculated as a % of equity — never hardcoded dollar amounts
  • Use strategy.entry() and strategy.exit() — not strategy.order()
  • Comment every non-obvious logic block clearly

Output structure:

//@version=5
strategy("Strategy Name", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// ── Inputs ──────────────────────────────────────────────
// All configurable values as inputs, not hardcoded

// ── Indicators ──────────────────────────────────────────
// Clean indicator calculations

// ── Entry Conditions ─────────────────────────────────────
// Named booleans for readability

// ── Exit Conditions ──────────────────────────────────────
// Stop loss and take profit logic

// ── Strategy Orders ──────────────────────────────────────
// strategy.entry() and strategy.exit() calls only

// ── Plots ────────────────────────────────────────────────
// Visual aids for debugging

After producing the code, explain each section and flag any assumptions made where the user's description was ambiguous.


Mode #2 — Debugger

Diagnose and fix issues in existing Pine Script code.

Ask the user to paste their code and describe the problem (error message, unexpected behaviour, or what they expected vs what happened).

Work through in this order:

  1. Syntax errors — identify the line and exact issue
  2. Logic errors — trace through the conditions step by step, find where the intent and the code diverge
  3. Repainting issues — is the script using security() calls, request.security() with lookahead, or barstate.islast in ways that peek at future data?
  4. Look-ahead bias — is any signal generated using data that wouldn't have been available at that bar's close?
  5. Series vs value confusion — common Pine v5 error: using a series where a simple value is needed
  6. Type errors — int/float/bool/string mismatches
  7. Strategy vs indicator context — calling strategy functions inside an indicator context or vice versa

For each issue found: show the problematic line, explain exactly why it's wrong, and provide the corrected version.


Mode #3 — Indicator → Strategy Converter

Take an existing indicator script and convert it into a backtest strategy with entry/exit logic.

Ask for:

  • The indicator code (paste it)
  • What signal should trigger a long entry
  • What signal should trigger a short entry (or long exit if long-only)
  • Stop loss method (% fixed, ATR multiple, or recent swing high/low)
  • Take profit method (% fixed, R multiple of stop, or trailing)
  • Whether to test long only, short only, or both

Convert faithfully — do not add new indicators or conditions beyond what was described. Add:

  • strategy() declaration replacing indicator()
  • Position sizing based on % of equity
  • Clear entry and exit orders
  • Commission and slippage inputs for realistic testing
  • A simple plot of entry/exit signals on the chart

Mode #4 — Alert Builder

Add TradingView alerts to an existing script so the user gets notified when conditions fire.

Ask for: the script (paste it), what condition should trigger a long alert, what condition should trigger a short alert, and whether they want alerts on entry only or also on exit.

Implement:

  • alertcondition() for each alert type with a descriptive message
  • Dynamic alert messages using string concatenation (include the asset, price, and signal type)
  • Proper use of barstate.isconfirmed to avoid alerts on unconfirmed bars (prevents false alerts on unclosed candles)
  • Webhook-compatible JSON format in the alert message if the user wants to connect to a bot or automation

Explain: how to create the alert in TradingView (right-click chart → Add Alert → select the condition), recommended alert frequency settings, and how to test that alerts fire correctly.


Mode #5 — Indicator Builder

Build a standalone indicator (not a strategy) — for visual analysis without backtesting.

Ask for:

  • What the indicator should show
  • Preferred visual style (lines, histogram, background colour, labels)
  • Whether it should appear on the main chart or in a separate pane

Code standards for indicators:

  • Use indicator() not strategy()
  • Expose all key parameters as inputs
  • Use consistent colour coding (green for bullish signals, red for bearish, grey for neutral)
  • Add hline() for key reference levels (overbought/oversold, zero line)
  • Use plot() with appropriate style= settings
  • If showing multiple lines, use plot() with distinct colours and labels

Mode #6 — Code Optimiser

Review and refactor existing Pine Script for clarity, performance, and reliability.

Ask the user to paste their script.

Review for:

  • Redundant calculations — recalculating the same indicator multiple times
  • Hardcoded values — any number that should be a user input
  • Magic numbers — undocumented constants with no explanation
  • Overly complex entry logic — can 5 conditions be simplified to 3 without losing the edge?
  • Repainting risk — any use of security() with lookahead=barmerge.lookahead_on
  • Variable naming — are variable names descriptive enough to understand without comments?
  • Dead code — variables calculated but never used
  • Version compatibility — any v4 functions that should be updated to v5 equivalents

Produce a refactored version with comments explaining what changed and why. Do not change the strategy logic — only the code quality.


Usage

If the user invokes /pine-script with no arguments, ask: "What do you need? Build a strategy, debug code, convert an indicator, add alerts, build an indicator, or optimise existing code?"

Always follow Pine Script v5 standards. If a user asks for v4 syntax, note the v5 equivalent. All strategies must include a stop loss. All position sizes must be % of equity. Keep the entry logic as simple as possible — complexity is the enemy of robustness.

よくある質問

AIスキル「Pine Script」では何ができますか?

Lewis's TradingView Pine script workflow. Strategy ideation → Pine code → on-chart preview, end-to-end.

TypingMindでPine Scriptを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Pine Scriptはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにPine Scriptをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jackson-video-resources/skills/tree/main/skills/pine-scriptを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Pine Scriptを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Pine Scriptは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもPine Scriptを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Pine Script」は無料ですか?

はい。jackson-video-resourcesがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇