name: freqtrade-strategy-dev description: "Develop, iterate, and improve Freqtrade cryptocurrency trading strategies. Use when writing a new strategy, improving an existing one, analyzing why a strategy is losing, or understanding which indicators to use. Covers strategy anatomy, key configuration parameters, proven entry/exit patterns, and the iteration workflow. Trigger phrases: write freqtrade strategy, improve strategy, why is my strategy losing, freqtrade indicators, strategy not profitable, freqtrade entry conditions." metadata: {"clawdbot":{"emoji":"🧠","requires":{"bins":["docker","docker-compose"]},"os":["linux","darwin","win32"]}}
Build profitable trading strategies with disciplined iteration, tight risk management, and data-driven entry/exit rules. Assumes Freqtrade is running via Docker (docker-compose).
Every Freqtrade strategy requires three methods:
populate_indicators(dataframe, metadata) — Add technical indicators (RSI, MACD, Bollinger Bands, etc.) to the dataframepopulate_entry_trend(dataframe, metadata) — Define buy signal logic; set enter_long = 1 when conditions metpopulate_exit_trend(dataframe, metadata) — Define sell signal logic; set exit_long = 1 when conditions met (optional if using ROI/stop-loss)小蔥技能站7w4.net,專業的AI技能分享平臺。
stoploss = -0.03 # 3% max loss per trade
trailing_stop = True
trailing_stop_positive = 0.01
trailing_stop_positive_offset = 0.02
minimal_roi = {
"0": 0.04, # 4% profit target immediately
"30": 0.02, # 2% after 30 candles
"60": 0.01, # 1% after 60 candles
}
timeframe = "5m" # or "15m", "1h", etc.
stake_currency = "USDT"
dry_run = True # Always backtest/dry-run first
stoploss = -0.03
trailing_stop = True
trailing_stop_positive = 0.01
trailing_stop_positive_offset = 0.02
minimal_roi = {"0": 0.04, "30": 0.02, "60": 0.01}
# In populate_indicators: calculate RSI, CCI, Bollinger Bands, EMA, Volume SMA
# In populate_entry_trend: only buy when ALL conditions met
conditions = [
(dataframe['rsi'] < 30), # Oversold
(dataframe['cci'] < -100), # Momentum confirmation
(dataframe['close'] < dataframe['bb_lowerband']), # Price near lower band
(dataframe['volume'] > dataframe['volume_sma']), # Volume confirms
(dataframe['bullish_candle']), # Pattern confirmation
]
dataframe.loc[reduce(lambda x, y: x & y, conditions), 'enter_long'] = 1
Keep all versions: name files MyStrategy_v1.py, MyStrategy_v2.py, etc. Add comments above each change explaining what improved and why. This preserves your iteration history and makes reverting safe.
references/indicators-guide.md — Technical indicator formulas and interpretationreferences/iteration-workflow.md — Step-by-step walkthrough of strategy optimization這個 Skill 質量較好,內容專業且實用。它把 Freqtrade 策略開發的核心知識講得很清楚,從基礎結構到迭代最佳化都有覆蓋,技術指標說明通俗易懂。迭代工作流程尤其有用,提供了一步步最佳化的思路。不過它偏向理論指導,缺少可以直接拿來用的完整策略程式碼示例,對新手來說可能需要補充更多實戰案例。另外有些進階功能沒有涉及,高階使用者可能會覺得深度不夠。總體適合入門和中級開發者打基礎用。