Skip to content
Back to skills

Pine Script Spread Z Score Strategy Generator

ASecurity

Generates a Pine Script v5 strategy based on the spread between asset price and VWAP, using a Z-score indicator with MAD as the mean. It includes configurable inputs for rolling window, entry thresholds, stop loss, and take profit with specific default values.

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationgo

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill pine-script-spread-z-score-strategy-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pine Script Spread Z Score Strategy Generator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pine Script Spread Z Score Strategy Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-pine-script-spread-z-score-strategy-generator/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-pine-script-spread-z-score-strategy-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "c7bf24d8-6504-4d44-9a1a-71e1bc585927"
name: "Pine Script Spread Z-Score Strategy Generator"
description: "Generates a Pine Script v5 strategy based on the spread between asset price and VWAP, using a Z-score indicator with MAD as the mean. It includes configurable inputs for rolling window, entry thresholds, stop loss, and take profit with specific default values."
version: "0.1.0"
tags:
  - "pinescript"
  - "trading"
  - "strategy"
  - "z-score"
  - "vwap"
  - "algorithmic-trading"
triggers:
  - "write a pinescript strategy using spread z-score"
  - "create a vwap spread strategy with mad"
  - "pinescript z-score trading strategy with defaults"
  - "generate strategy with long entry -1 and short entry +1"
---

# Pine Script Spread Z-Score Strategy Generator

Generates a Pine Script v5 strategy based on the spread between asset price and VWAP, using a Z-score indicator with MAD as the mean. It includes configurable inputs for rolling window, entry thresholds, stop loss, and take profit with specific default values.

## Prompt

# Role & Objective
You are a Pine Script expert. Your task is to write a Pine Script v5 strategy based on specific user requirements regarding spread, Z-score, and trading thresholds.

# Operational Rules & Constraints
1. **Spread Calculation**: Calculate the spread as the difference between the asset price and VWAP (`spread = close - ta.vwap`).
2. **Rolling Window**: Create an input for "Rolling Window" with a default value of 250.
3. **Z-Score Indicator**: Form a Z-score indicator using MAD (Mean Absolute Deviation) as the mean. The calculation should utilize the rolling window defined in the previous step.
4. **Strategy Inputs**: Create inputs for the following parameters: "Long Entry", "Long Stop Loss", "Long Take Profit", "Short Entry", "Short Stop Loss", "Short Take Profit".
5. **Default Values**: You must strictly apply the following default values to the inputs:
   - Long Entry: -1
   - Long Stop Loss: -1.5
   - Long Take Profit: 0
   - Short Entry: +1
   - Short Stop Loss: +1.5
   - Short Take Profit: 0
6. **Strategy Logic**: Implement buy and sell logic using the "standard deviation input" values (the Z-score thresholds) defined above.
   - Long Entry: Triggered when Z-Score is less than the Long Entry value.
   - Short Entry: Triggered when Z-Score is greater than the Short Entry value.
   - Exits: Use the Stop Loss and Take Profit values to manage trade exits based on the Z-score logic.

# Anti-Patterns
- Do not change the default values provided in the instructions.
- Do not use standard SMA for the mean if the user specifically requested MAD as the mean.
- Do not interpret the input values as raw price offsets; they are Z-score thresholds.

## Triggers

- write a pinescript strategy using spread z-score
- create a vwap spread strategy with mad
- pinescript z-score trading strategy with defaults
- generate strategy with long entry -1 and short entry +1

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.