
Trading Strategist
Compute SMA, EMA, RSI, Bollinger Bands, and MACD from historical closes when prototyping crypto trading logic with an agent.
Overview
Trading Strategist is an agent skill for the Build phase that calculates crypto technical-analysis indicators (SMA, EMA, RSI, Bollinger, MACD) from historical price data.
Install
npx skills add https://github.com/kukapay/crypto-skills --skill trading-strategistWhat is this skill?
- Python helpers for SMA and EMA with configurable periods
- RSI(14) from close deltas with gain/loss averaging
- Bollinger Bands (20, 2σ) via SMA and standard deviation
- MACD (12, 26, 9) calculation path in script
- JSON-oriented script intended as TA backend for agent workflows
- RSI default period 14
- Bollinger Bands default period 20 with 2 standard deviations
- MACD parameters 12, 26, 9
Adoption & trust: 750 installs on skills.sh; 23 GitHub stars; 1/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You have OHLC or close history but no quick, repeatable way to compute standard TA signals inside an agent-driven trading experiment.
Who is it for?
Indie builders scripting TA on historical crypto data before wiring a full bot or dashboard.
Skip if: Discretionary trading advice, portfolio allocation without your own risk model, or production trading without separate data feeds and compliance checks.
When should I use this skill?
User needs TA indicators computed from historical market data for trading strategy work.
What do I get? / Deliverables
You get computed indicator values from your series so you can prototype rules, alerts, or downstream strategy steps in code.
- Indicator values (SMA, EMA, RSI, Bollinger upper/mid/lower, MACD components)
- JSON-friendly numeric output from the TA script
Recommended Skills
Journey fit
Indicator math belongs in Build when you wire market data into strategy scripts or bots—not in launch or growth marketing. Integrations subphase covers pulling price series and deriving signals your trading stack consumes.
How it compares
Skill-delivered calculation script—not a hosted exchange API or visual charting platform.
Common Questions / FAQ
Who is trading-strategist for?
Developers and solo builders who combine agent workflows with Python and need standard TA indicators from historical closes.
When should I use trading-strategist?
Use it in Build while integrating market data into scripts when you need RSI, moving averages, Bollinger Bands, or MACD for crypto strategy prototyping.
Is trading-strategist safe to install?
Check the Security Audits panel on this Prism page; trading skills can encourage financial risk—audit the repo and never trust indicators alone for live orders.
SKILL.md
READMESKILL.md - Trading Strategist
#!/usr/bin/env python3 """ Trading Strategies Skill - TA Calculation Script Calculates technical analysis indicators from historical market data. """ import sys import json import statistics def calculate_sma(data, period): """Simple Moving Average""" if len(data) < period: return None return sum(data[-period:]) / period def calculate_ema(data, period): """Exponential Moving Average""" if len(data) < period: return None multiplier = 2 / (period + 1) ema = data[0] for price in data[1:]: ema = (price * multiplier) + (ema * (1 - multiplier)) return ema def calculate_rsi(closes, period=14): """Relative Strength Index""" if len(closes) < period + 1: return None deltas = [closes[i] - closes[i-1] for i in range(1, len(closes))] gains = [d if d > 0 else 0 for d in deltas] losses = [-d if d < 0 else 0 for d in deltas] avg_gain = sum(gains[-period:]) / period avg_loss = sum(losses[-period:]) / period if avg_loss == 0: return 100 rs = avg_gain / avg_loss return 100 - (100 / (1 + rs)) def calculate_bollinger_bands(closes, period=20, std_dev=2): """Bollinger Bands""" if len(closes) < period: return None, None, None sma = calculate_sma(closes, period) std = statistics.stdev(closes[-period:]) upper = sma + (std_dev * std) lower = sma - (std_dev * std) return upper, sma, lower def calculate_macd(closes): """MACD (12, 26, 9) - returns MACD line, signal line approx""" if len(closes) < 26: return None, None ema12 = calculate_ema(closes, 12) ema26 = calculate_ema(closes, 26) macd_line = ema12 - ema26 # Simple signal approximation (should be EMA9 of MACD, but simplified) signal_line = macd_line # Placeholder return macd_line, signal_line def calculate_stochastic(highs, lows, closes, period=14): """Stochastic %K""" if len(highs) < period or len(lows) < period or len(closes) < period: return None high_period = max(highs[-period:]) low_period = min(lows[-period:]) if high_period == low_period: return 50 # Neutral k = 100 * (closes[-1] - low_period) / (high_period - low_period) return k def calculate_indicators(klines_data): """ Input: list of klines [ [timestamp, open, high, low, close, volume, ...], ... ] Output: dict of indicators """ closes = [float(k[4]) for k in klines_data] highs = [float(k[2]) for k in klines_data] lows = [float(k[3]) for k in klines_data] volumes = [float(k[5]) for k in klines_data] indicators = {} # Price metrics indicators['current_price'] = closes[-1] indicators['price_change_24h'] = None # Would need 24h data indicators['volume_24h'] = sum(volumes[-1:]) # Last candle volume # Moving Averages indicators['sma_20'] = calculate_sma(closes, 20) indicators['sma_10'] = calculate_sma(closes, 10) indicators['ema_12'] = calculate_ema(closes, 12) indicators['ema_26'] = calculate_ema(closes, 26) # Momentum indicators['rsi_14'] = calculate_rsi(closes, 14) # Bollinger Bands bb_upper, bb_middle, bb_lower = calculate_bollinger_bands(closes, 20, 2) indicators['bb_upper'] = bb_upper indicators['bb_middle'] = bb_middle indicators['bb_lower'] = bb_lower # MACD macd_line, signal_line = calculate_macd(closes) indicators['macd_line'] = macd_line indicators['macd_signal'] = signal_line indicators['macd_histogram'] = macd_line - signal_line if macd_line and signal_line else None # Stochastic indicators['stochastic_k'] = calculate_stochastic(highs, lows, closes, 14) return indicators if __name__ == "__main__": # Example usage: read from stdin as JSON data = json.load(sys.stdin) result = calculate_indicators(data) print(json.dumps(result, indent=2))</content> <parameter name="filePath">./skills/trading-strategies/scripts/calculate_ta.py --- name: tra