"""Staged 1m burst experiment. Disabled without an explicit ten-minute session. Separate profile/database required. No existing engine is switched by this file. """ from datetime import datetime,timezone,timedelta import math from freqtrade.strategy import IStrategy from freqtrade.persistence import Trade class NiblitMicroDemo(IStrategy): INTERFACE_VERSION=3 timeframe='1m' startup_candle_count=40 process_only_new_candles=True can_short=False stoploss=-.004 minimal_roi={'0':.003} use_exit_signal=True def populate_indicators(self,df,metadata): df['fast']=df['close'].ewm(span=9,adjust=False).mean() df['slow']=df['close'].ewm(span=21,adjust=False).mean() return df def populate_entry_trend(self,df,metadata): condition=(df['volume']>0)&(df['fast']>df['slow'])&(df['close'].shift(1)<=df['fast'].shift(1))&(df['close']>df['fast']) df.loc[condition,['enter_long','enter_tag']]=[1,'niblit_micro_v1'] return df def populate_exit_trend(self,df,metadata): df.loc[(df['close']=5:return False if sum(float(t.close_profit_abs or 0) for t in history)<=-min(2.,float(self.wallets.get_total_stake_amount())*.01):return False if any(t.close_date_utc and current_time-t.close_date_utc0 and (min_stake is None or stake>=min_stake) else 0. def custom_exit(self,pair,trade,current_time,current_rate,current_profit,**kwargs): if self.config.get('dry_run') is not True:return None peak=max(float(trade.get_custom_data(key='micro_peak_profit') or 0),float(current_profit)) trade.set_custom_data(key='micro_peak_profit',value=peak) if peak>=.004 and peak-current_profit>=.0015 and current_profit>=.002:return 'micro_profit_giveback' if current_time-trade.open_date_utc>=timedelta(minutes=5):return 'micro_time_limit' return None