Install
$ agentstack add skill-mahmoud20138-tradecraft-chart-vision ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Chart Vision — Complete Pipeline
Overview
Unified skill covering the entire chart image pipeline in one place:
- Rendering — produce high-quality candlestick chart images from OHLCV data
- Preprocessing — clean, denoise, and normalize raw chart screenshots
- Candlestick Vision — detect single and multi-candle patterns from images
- Chart Pattern Vision — detect H&S, triangles, wedges, double tops from images
- Pattern Scanner — algorithmic classical pattern detection from price data
- Trendline & S/R Vision — detect trendlines, channels, S/R zones from images
- Annotation Overlay — draw all analysis results back onto the chart image
Pipeline Order
chart-vision-renderer → render OHLCV to PNG
chart-image-preprocessor → clean, denoise, extract ROI
chart-pattern-vision → detect candle + chart patterns from image
trendline-sr-vision → detect S/R and trendlines from image
chart-pattern-scanner → detect patterns from price data (no image needed)
chart-annotation-overlay → draw everything back onto chart ← final step
Reference Files
| File | Contents | |------|----------| | references/rendering.md | Chart renderer: mplfinance + matplotlib, indicators, dark/light themes | | references/preprocessing.md | Image preprocessing: denoise, ROI extract, grid removal, contrast, color analysis | | references/pattern-vision.md | CV candlestick detection + classical chart pattern detection from images | | references/trendline-sr.md | Hough transforms, LSD, horizontal projection, S/R clustering, channels | | references/scanner-and-annotation.md | Price-data pattern scanner (swing-based) + annotation overlay drawing engine |
Stack
- mplfinance — candlestick rendering
- matplotlib 3.10 — rendering engine
- OpenCV 4.13 — all CV operations (Hough, LSD, morphology, edge detection, drawing)
- scikit-image 0.26 — region props, probabilistic Hough, restoration
- scipy 1.17 — peak finding, signal processing, clustering
- Pillow 12.1 — text rendering, image post-processing
- numpy 2.4 — array operations
- sklearn — RandomForest, GradientBoosting, calibration, TimeSeriesSplit (AI signal aggregation & ML)
- statsmodels — ADF, Granger causality (statistical analysis)
Quick Usage Examples
Render a chart from OHLCV data
import mplfinance as mpf
import pandas as pd
df = pd.read_csv("ohlcv.csv", index_col="date", parse_dates=True)
mpf.plot(df, type="candle", style="charles", volume=True,
mav=(20, 50), savefig="chart.png", figsize=(14, 8))
Preprocess a chart screenshot
import cv2
import numpy as np
img = cv2.imread("screenshot.png")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Remove grid lines
denoised = cv2.fastNlMeansDenoising(gray, h=15)
# Enhance edges for pattern detection
edges = cv2.Canny(denoised, 50, 150)
# Extract ROI (crop to chart area)
contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
largest = max(contours, key=cv2.contourArea)
x, y, w, h = cv2.boundingRect(largest)
chart_roi = img[y:y+h, x:x+w]
Detect support/resistance from image
from scipy.signal import find_peaks
# Project pixel intensities horizontally to find price levels
projection = np.mean(gray, axis=1)
peaks, props = find_peaks(-projection, distance=20, prominence=10)
sr_levels = peaks # pixel y-coordinates of S/R lines
# Draw detected levels
for level in sr_levels:
cv2.line(img, (0, level), (img.shape[1], level), (0, 255, 0), 1)
Annotate chart with analysis
from PIL import Image, ImageDraw, ImageFont
img = Image.open("chart.png")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("arial.ttf", 14)
# Draw buy signal
draw.text((entry_x, entry_y - 20), "BUY", fill="green", font=font)
draw.rectangle([sl_x-2, sl_y-2, sl_x+2, sl_y+2], fill="red")
draw.text((sl_x + 5, sl_y), f"SL: {sl_price:.5f}", fill="red", font=font)
draw.text((tp_x + 5, tp_y), f"TP: {tp_price:.5f}", fill="green", font=font)
img.save("annotated_chart.png")
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: mahmoud20138
- Source: mahmoud20138/Tradecraft
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.