AegisGridTradition - Traditional Static Parameter Strategy رویکرد: استفاده از پارامترهای کلاسیک و ثابت (بدون فضای بهینهسازی پویا) تکنیک: MACD Crossover + RSI Filter + Fixed ATR Trailing Stop
Timeframe
1h
Direction
Long Only
Stoploss
-10.0%
Trailing Stop
Yes
ROI
N/A
Interface Version
3
Startup Candles
N/A
Indicators
3
freqtrade/freqtrade-strategies
freqtrade/freqtrade-strategies
this is an example class, implementing a PSAR based trailing stop loss you are supposed to take the `custom_stoploss()` and `populate_indicators()` parts and adapt it to your own strategy
freqtrade/freqtrade-strategies
Strategy 003 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
import pandas as pd
import talib.abstract as ta
from freqtrade.strategy import IStrategy
from pandas import DataFrame
class AegisGridTradition(IStrategy):
"""
AegisGridTradition - Traditional Static Parameter Strategy
رویکرد: استفاده از پارامترهای کلاسیک و ثابت (بدون فضای بهینهسازی پویا)
تکنیک: MACD Crossover + RSI Filter + Fixed ATR Trailing Stop
"""
INTERFACE_VERSION = 3
timeframe = '1h'
startup_candle_count: int = 50
# مقادیر کاملاً ثابت (Hardcoded) برای تستهای سنتی
buy_rsi_threshold = 30
sell_rsi_threshold = 70
atr_multiplier = 2.0
stoploss = -0.10
trailing_stop = True
trailing_stop_positive = 0.02
trailing_stop_positive_offset = 0.04
roi = {"0": 0.05, "60": 0.02, "120": 0}
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# MACD با تنظیمات استاندارد 12, 26, 9
macd = ta.MACD(dataframe, fastperiod=12, slowperiod=26, signalperiod=9)
dataframe['macd'] = macd['macd']
dataframe['macdsignal'] = macd['macdsignal']
# RSI با دوره استاندارد 14
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
# ATR برای محاسبه نوسانات
dataframe['atr'] = ta.ATR(dataframe, timeperiod=14)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['macd'] > dataframe['macdsignal']) & # تقاطع مثبت مکدی
(dataframe['rsi'] < self.buy_rsi_threshold) & # منطقه اشباع فروش
(dataframe['volume'] > 0)
),
'enter_long'] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['macd'] < dataframe['macdsignal']) & # تقاطع منفی مکدی
(dataframe['rsi'] > self.sell_rsi_threshold) # منطقه اشباع خرید
),
'exit_long'] = 1
return dataframe