freqtrade / freqtrade-strategies

Free trading strategies for Freqtrade bot
GNU General Public License v3.0
3.27k stars 1.11k forks source link

it donesnt work. I check the backtesting source code file backtesting.py line no 498: #273

Closed gitscamI closed 1 year ago

gitscamI commented 1 year ago
    it donesnt work.   I check the backtesting source code   file backtesting.py line no 498:
def _get_adjust_trade_entry_for_candle(self, trade: LocalTrade, row: Tuple
                                           ) -> LocalTrade:
        current_profit = trade.calc_profit_ratio(row[OPEN_IDX])
        min_stake = self.exchange.get_min_pair_stake_amount(trade.pair, row[OPEN_IDX], -0.1)
        max_stake = self.exchange.get_max_pair_stake_amount(trade.pair, row[OPEN_IDX])
        stake_available = self.wallets.get_available_stake_amount()
        stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position,
                                             default_retval=None)(
            trade=trade,  # type: ignore[arg-type]
            current_time=row[DATE_IDX].to_pydatetime(), current_rate=row[OPEN_IDX],
            current_profit=current_profit, min_stake=min_stake,
            max_stake=min(max_stake, stake_available))

        # Check if we should increase our position
        if stake_amount is not None and stake_amount > 0.0:

            pos_trade = self._enter_trade(
                trade.pair, row, 'short' if trade.is_short else 'long', stake_amount, trade)
            if pos_trade is not None:
                self.wallets.update()
                return pos_trade

        return trade

when return stake_amount <0, it will be pass. is it ???

Originally posted by @gitscamI in https://github.com/freqtrade/freqtrade-strategies/issues/269#issuecomment-1278456048

xmatthias commented 1 year ago

Please use appropriate naming for your issues. "it doesn't work" is not an issue title.

You should also try to outline what you're trying to accomplish - i'll not go back/forth between issues.