Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Trading Strategy Development Directory

This directory contains manual trading strategy definitions that can be systematically converted into Jesse framework implementations using the AI Dev Tasks workflow.

Quick Start

  1. Create a new strategy: Copy template.md and rename it to [your-strategy-name].md
  2. Fill in strategy details using the comprehensive template structure
  3. Convert to implementation using the AI Dev Tasks workflow:
    • Use create-prd.md to generate a Product Requirements Document
    • Use generate-tasks.md to create implementation tasks
    • Use process-task-list.md for step-by-step development

File Structure

/cj-strat/
├── template.md                    # Comprehensive strategy template
├── README.md                      # This file
├── [strategy-name].md             # Your strategy definitions
├── [another-strategy].md          # Additional strategies
└── ...

Using the Template

1. Strategy Creation Process

  1. Copy the template:

    cp template.md golden-cross-strategy.md
  2. Fill in all sections:

    • Overview: Strategy type, timeframe, risk level
    • Core Logic: Entry/exit conditions with specific rules
    • Technical Indicators: Required indicators from Jesse's library
    • Data Requirements: Timeframes and historical data needs
    • Testing Parameters: Backtest configuration
  3. Be specific and detailed:

    • Use exact indicator parameters: RSI(14) < 30
    • Define clear conditions: SMA(20) crosses above SMA(50)
    • Specify risk management: Stop loss at 2% below entry

2. Strategy Template Sections

Required Sections

  • Overview: High-level strategy description
  • Core Logic: Entry/exit conditions for long/short positions
  • Technical Indicators: All indicators needed with parameters
  • Data Requirements: Timeframes and lookback periods

Optional Sections

  • Performance Expectations: Expected returns and drawdown
  • Testing Parameters: Backtest and optimization settings
  • Risk Considerations: Potential issues and mitigation
  • Implementation Notes: Jesse-specific considerations

3. Jesse Framework Integration

Available Indicators

The template includes examples of Jesse's 100+ indicators:

ta.sma(candles, period=20)           # Simple Moving Average
ta.ema(candles, period=20)           # Exponential Moving Average  
ta.rsi(candles, period=14)           # Relative Strength Index
ta.macd(candles, fast=12, slow=26, signal=9)  # MACD
ta.atr(candles, period=14)           # Average True Range
# See /jesse/indicators/ for complete list

Strategy Class Structure

Your strategies will be implemented as:

class YourStrategy(Strategy):
    def should_long(self) -> bool:
        # Entry logic from your strategy.md
        
    def should_short(self) -> bool:  
        # Entry logic from your strategy.md
        
    def go_long(self):
        # Position management from your strategy.md
        
    def go_short(self):
        # Position management from your strategy.md

AI Dev Tasks Workflow

Step 1: Create PRD

Use the create-prd.md process to convert your strategy.md into a detailed Product Requirements Document:

# Reference your strategy file when using create-prd.md
# This converts strategy logic into technical requirements

Step 2: Generate Tasks

Use generate-tasks.md to break down the PRD into implementation tasks:

# Points to your PRD file
# Creates step-by-step development tasks
# Identifies relevant Jesse framework files

Step 3: Process Tasks

Use process-task-list.md for systematic implementation:

# Guides through each implementation task
# Ensures proper Jesse framework integration
# Includes testing and validation steps

Best Practices

Strategy Definition

  1. Be Specific: Use exact parameters and clear conditions
  2. Consider Edge Cases: Define behavior in different market conditions
  3. Plan Risk Management: Include stop loss and position sizing rules
  4. Think About Data: Ensure required timeframes and indicators are available

Jesse Implementation

  1. Check Indicators: Verify all indicators exist in /jesse/indicators/
  2. Plan Data Access: Use self.candles for historical data
  3. Implement Risk Management: Leverage Jesse's built-in tools
  4. Plan Testing: Use Jesse's comprehensive backtesting system

Development Workflow

  1. Start Simple: Begin with basic strategy logic
  2. Test Early: Run backtests frequently during development
  3. Optimize Carefully: Use systematic parameter optimization
  4. Document Everything: Keep detailed notes on decisions and results

Examples

Simple Moving Average Crossover

# Golden Cross Strategy

## Overview
- **Strategy Type**: Trend Following
- **Timeframe**: 4h
- **Market Conditions**: Trending markets
- **Risk Level**: Medium

## Core Logic

### Long Entry
- **Primary Signal**: SMA(50) crosses above SMA(200)
- **Confirmation**: Volume > 1.5 * average volume

### Short Entry  
- **Primary Signal**: SMA(50) crosses below SMA(200)
- **Confirmation**: Volume > 1.5 * average volume

## Technical Indicators Required
- **SMA(50)**: 50-period simple moving average - Short-term trend
- **SMA(200)**: 200-period simple moving average - Long-term trend
- **Volume**: Trading volume - Confirmation signal

Integration with Jesse

File Locations

  • Strategy files: Will be created in /jesse/strategies/[YourStrategy]/
  • Tests: Corresponding test files in appropriate test directories
  • Backtests: Results stored via Jesse's built-in metrics system

Development Commands

# Install Jesse in development mode
pip install -e .

# Run backtests
jesse backtest [strategy-name] [exchange] [pair] [timeframe] [start-date] [end-date]

# Run tests
pytest tests/

# Start web interface for analysis
jesse run

Troubleshooting

Common Issues

  1. Missing Indicators: Check /jesse/indicators/ for availability
  2. Data Requirements: Ensure sufficient historical data
  3. Parameter Conflicts: Verify strategy logic is consistent
  4. Performance Issues: Consider numpy array operations for efficiency

Getting Help

  1. Review Jesse documentation
  2. Check existing strategy examples in /jesse/strategies/
  3. Use the AI Dev Tasks workflow for systematic development
  4. Test with small datasets first

Next Steps

  1. Create your first strategy using the template
  2. Test the workflow with a simple strategy like moving average crossover
  3. Iterate and improve based on backtest results
  4. Scale up to more complex strategies once comfortable with the process

The goal is systematic, repeatable strategy development that leverages Jesse's powerful framework while maintaining clear documentation and testing practices.