Loading...
Loading...
AI-powered generation of complete trading strategy code. Uses create_strategy and create_prediction_market_strategy to transform requirements into production-ready Python code. Most expensive AI tool ($1.00-$4.50 per generation). Generates complete Jesse framework strategies with entry/exit logic, position sizing, and risk management. Use after exploring data and optionally generating ideas. ALWAYS test with test-trading-strategies before deploying.
npx skill4agent add robonet-tech/skills build-trading-strategiesUse MCPSearch to select: mcp__workbench__create_strategy
Use MCPSearch to select: mcp__workbench__create_prediction_market_strategycreate_strategy(
strategy_name="RSIMeanReversion_M",
description="Buy when RSI(14) < 30 and price at lower Bollinger Band (20,2).
Sell when RSI > 70 or price at middle Bollinger Band.
Stop loss at 2% below entry. Position size 90% of available margin."
)design-trading-strategiesimprove-trading-strategiesbrowse-robonet-datastrategy_name{Name}_{RiskLevel}[_suffix]descriptionshould_long()should_short()go_long()go_short()on_open_position()update_position()should_cancel_entry()strategy_namedescriptionshould_buy_yes()should_buy_no()go_yes()go_no()should_sell_yes()should_sell_no()on_market_resolution()class MyStrategy(Strategy):
def should_long(self) -> bool:
"""Check if all conditions are met for long entry"""
# Return True to signal long entry opportunity
# Called every candle
def should_short(self) -> bool:
"""Check if all conditions are met for short entry"""
# Return True to signal short entry opportunity
# Called every candle
def go_long(self):
"""Execute long entry with position sizing"""
# Calculate position size (qty)
# Place buy order
# Set stop loss and take profit in on_open_position()
def go_short(self):
"""Execute short entry with position sizing"""
# Calculate position size (qty)
# Place sell order
# Set stop loss and take profit in on_open_position() def on_open_position(self, order):
"""Set stop loss and take profit after entry"""
# Called when position opens
# Set self.stop_loss and self.take_profit
def update_position(self):
"""Update position (trailing stops, etc.)"""
# Called every candle while in position
# Modify stop loss for trailing stops
def should_cancel_entry(self) -> bool:
"""Cancel unfilled entry orders"""
# Return True to cancel pending entry order{Name}_{RiskLevel}[_suffix]RSIMeanReversion_MMomentumBreakout_H_optimizedTrendFollower_L_alloraBollingerBands_M_v2def go_long(self):
qty = utils.size_to_qty(self.balance * 0.90, self.price)
self.buy = qty, self.pricedef go_long(self):
atr = ta.atr(self.candles, period=14)
# Reduce size in high volatility
size_multiplier = 0.90 if atr < self.price * 0.02 else 0.70
qty = utils.size_to_qty(self.balance * size_multiplier, self.price)
self.buy = qty, self.pricedef go_long(self):
atr = ta.atr(self.candles, period=14)
stop_distance = atr * 2 # Stop at 2× ATR
# Risk 2% of balance per trade
risk_amount = self.balance * 0.02
qty = risk_amount / stop_distance
self.buy = qty, self.pricedef on_open_position(self, order):
atr = ta.atr(self.candles, period=14)
# Stop at 2× ATR below entry (long) or above entry (short)
self.stop_loss = qty, self.price - (atr * 2) # Long
# or
self.stop_loss = qty, self.price + (atr * 2) # Shortdef on_open_position(self, order):
atr = ta.atr(self.candles, period=14)
# Target at 3× ATR (risk/reward = 1.5)
self.take_profit = qty, self.price + (atr * 3) # Longjesse.indicators(Use browse-robonet-data skill)
get_all_technical_indicators(category="momentum")browse-robonet-datadesign-trading-strategies1. browse-robonet-data ($0.001) → Verify resources
2. design-trading-strategies ($0.30) → Explore 3 ideas
3. Pick best idea and refine description
4. create_strategy ($2.50) → Generate once, correctly
Total: $2.80 with high success rate
vs.
1. create_strategy ($2.50) → Vague requirements
2. Doesn't work, try again ($2.50)
3. Still not right ($2.50)
Total: $7.50 with frustrationEntry Conditions:
- Specific indicator with exact parameters
- Exact thresholds
- Multiple conditions with AND/OR logic
Exit Conditions:
- Stop loss method and distance
- Take profit method and target
- Trailing stop if applicable
Position Sizing:
- Percentage of margin to use
- Or risk-based sizing method
Risk Management:
- Maximum loss per trade
- Any position limits
Context:
- Timeframe (5m, 1h, 4h, 1d)
- Market regime (trending, ranging)"RSI Mean Reversion strategy for BTC-USDT on 1h timeframe.
ENTRY (Long):
- RSI(14) < 30 (oversold)
- Price touches lower Bollinger Band (20-period, 2 std dev)
- Confirm with volume: current volume > 1.2× 20-period average
EXIT (Long):
- Take profit: Price reaches middle Bollinger Band
- Stop loss: 2% below entry price
- Trailing stop: Once profit >3%, trail stop at 1.5% below highest price
POSITION SIZING:
- Use 90% of available margin per trade
- Single position at a time (no pyramiding)
RISK MANAGEMENT:
- Maximum loss: 2% of account per trade
- No new trades if in drawdown >10%""Build a profitable BTC strategy using RSI and Bollinger Bands"ta.rsi(self.candles, period=14)improve-trading-strategiescreate_strategy"For 1h timeframe..." (helps AI tune indicator parameters appropriately)1. Explore data (use browse-robonet-data):
get_all_symbols() → Choose BTC-USDT
get_all_technical_indicators(category="momentum") → Pick RSI
get_all_technical_indicators(category="volatility") → Pick Bollinger Bands
2. Optional: Generate ideas (use design-trading-strategies):
generate_ideas(strategy_count=3) → Get concepts
Pick best concept as starting point
3. Write detailed description:
- Entry: RSI < 30 AND price at lower BB
- Exit: Price at middle BB OR stop loss 2%
- Sizing: 90% margin
- Timeframe: 1h
4. Create strategy:
create_strategy(
strategy_name="RSIMeanReversion_M",
description="[detailed description from step 3]"
)
5. Validate generated code:
- Check all required methods present
- Verify indicators match description
- Confirm risk management included
6. Test immediately (use test-trading-strategies):
run_backtest(strategy_name="RSIMeanReversion_M", ...)1. Generate ideas (use design-trading-strategies):
generate_ideas(strategy_count=3)
Idea #2: "Bollinger Band Breakout"
Entry: Price breaks above upper BB with high volume
Exit: Price returns to middle BB
Uses: Bollinger Bands, Volume
2. Refine idea into detailed description:
"Bollinger Band Breakout strategy for ETH-USDT on 4h timeframe.
ENTRY (Long):
- Price closes above upper Bollinger Band (20, 2)
- Current volume > 1.5× 20-period average volume
- ADX(14) > 25 (confirm trend strength)
EXIT (Long):
- Price closes below middle Bollinger Band
- Or stop loss 3% below entry
- Or take profit at 9% above entry (3:1 reward:risk)
POSITION SIZING: 85% of margin
RISK: Max 3% loss per trade"
3. Create strategy:
create_strategy(
strategy_name="BollingerBreakout_H",
description="[detailed description from step 2]"
)
4. Test and validate:
run_backtest(strategy_name="BollingerBreakout_H", ...)1. Browse prediction markets (use browse-robonet-data):
get_data_availability(data_type="polymarket")
→ See available markets
2. Analyze market data:
get_prediction_market_data(condition_id="...")
→ Study YES/NO token price history
3. Write detailed description:
"Polymarket probability arbitrage strategy for crypto_rolling markets.
BUY YES TOKEN when:
- YES token price < 0.40 (implied 40% probability)
- Market has >$10k volume (sufficient liquidity)
- Time to resolution > 2 hours (avoid last-minute volatility)
BUY NO TOKEN when:
- NO token price < 0.40 (YES price > 0.60)
- Same liquidity and time criteria
EXIT:
- Sell when price reaches 0.55 (15% profit target)
- Or hold until market resolution
- Stop loss: Sell if price drops to 0.25 (37.5% loss)
POSITION SIZING: 5% of capital per market
MAX POSITIONS: 10 simultaneous markets"
4. Create prediction market strategy:
create_prediction_market_strategy(
strategy_name="PolymarketArbitrage_M",
description="[detailed description from step 3]"
)
5. Test on historical markets:
run_prediction_market_backtest(...)"ETH-USDT swing trading strategy on 1h timeframe with 4h trend filter.
HIGHER TIMEFRAME (4h):
- Only take long trades when 4h EMA(50) is rising
- Only take short trades when 4h EMA(50) is falling
ENTRY TIMEFRAME (1h):
- [standard entry conditions on 1h]
...""Entry requires ALL of these conditions (AND logic):
1. RSI(14) < 30
2. Price < Lower Bollinger Band (20, 2)
3. MACD histogram positive (bullish divergence)
4. Volume > 1.3× average
OR entry if these alternative conditions met:
1. Price makes higher low
2. RSI makes higher low (bullish divergence)
3. Volume surge (>2× average)""Position sizing based on volatility:
- When ATR(14) < 2% of price: Use 95% margin (low volatility)
- When ATR between 2-4%: Use 85% margin (normal)
- When ATR > 4%: Use 70% margin (high volatility)
This reduces risk during volatile periods."improve-trading-strategiesrefine_strategyimprove-trading-strategiesbrowse-robonet-datarefine_strategyrefine_strategyrefine_strategytest-trading-strategiesimprove-trading-strategiesdeploy-live-tradingtest-trading-strategies