risk_management

Calculate position sizes and trailing stops using ATR and moving averages.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/benitorhuang-svg/tw-stock-app --skill risk-management-benitorhuang-svg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: risk_management
Source: https://github.com/benitorhuang-svg/tw-stock-app/tree/main/.agents/skills/risk_management
Command: npx skills add https://github.com/benitorhuang-svg/tw-stock-app --skill risk-management-benitorhuang-svg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the critical need for robust risk management in trading by providing a systematic approach to position sizing and dynamic exit strategies, ensuring capital preservation and profit maximization.

Core Features & Use Cases

  • Position Sizing: Calculates precise trade volumes based on total capital and risk tolerance (e.g., 2% rule).
  • Dynamic Exit Mechanisms: Implements trailing stops (ATR, Moving Averages) and time-based stops to lock in profits and cut losses.
  • Risk Scenario Matrix: Defines actions for various market conditions and risk events (e.g., market downturns, institutional sell-offs).
  • Use Case: Automatically determine the optimal number of shares to buy for a new trade based on your entry price, stop-loss level (e.g., 20-day moving average), and your total trading capital, ensuring no single trade risks more than 2% of your portfolio.

Quick Start

Use the risk_management skill to calculate the position size for a trade with a total capital of 1,000,000, an entry price of 100, and a stop loss price of 90.

Frequently Asked Questions about risk_management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate position sizing based on the 2% risk rule for stock trading?

Position sizing based on the 2% risk rule is calculated by determining the trade volume that ensures no single trade risks more than 2% of your total trading capital. You input your entry price, stop-loss level, and total capital to calculate the optimal number of shares to buy.

How does an ATR trailing stop loss work for managing trade risk?

An ATR trailing stop loss manages trade risk by dynamically adjusting the exit point based on market volatility. It trails the price to lock in profits and cut losses, ensuring capital preservation during volatile stock market conditions.

Can I use a moving average as a dynamic stop loss for exiting trades?

Yes, you can use a moving average as a dynamic stop loss. The risk management mechanism implements trailing stops based on market trends, using indicators like the 20-day moving average to define exit strategies and lock in profits.

What is the best way to automate exit strategies for volatile stock markets?

The best way to automate exit strategies for volatile stock markets is integrating dynamic position sizing with trailing stop-loss mechanisms based on ATR and moving averages. This approach uses a risk scenario matrix to define actions for market downturns and institutional sell-offs.

Does this risk management approach require integration with market data APIs?

Yes, this risk management approach integrates with market data APIs and backtesting results to ensure capital preservation and optimize profit realization. It uses real-time financial indicators to calculate precise trade volumes and execute dynamic exit strategies.

Why use a risk scenario matrix when defining trading exit strategies?

A risk scenario matrix is used when defining trading exit strategies to predefine specific actions for various market conditions and risk events. It addresses scenarios like market downturns and institutional sell-offs, ensuring systematic capital preservation.