# source: https://raw.githubusercontent.com/augiemazza/varrd/7dd86d3c26eba600e89aa03fb22e4e1986009427/varrd/freqtrade/templates/strategy_template.py
{# Jinja2 template — rendered by generator.py to produce a valid Freqtrade strategy #}
# --- Generated by VARRD {{ version Github_augiemazza_varrd__strategy_template__20260308_231039 ---
# This strategy was statistically validated by VARRD before generation.
# Do NOT modify the entry logic without re-validating.
#
# Hypothesis: {{ hypothesis_name Github_augiemazza_varrd__strategy_template__20260308_231039
# Market:     {{ market Github_augiemazza_varrd__strategy_template__20260308_231039 ({{ pair Github_augiemazza_varrd__strategy_template__20260308_231039)
# Direction:  {{ direction Github_augiemazza_varrd__strategy_template__20260308_231039
# Timeframe:  {{ timeframe Github_augiemazza_varrd__strategy_template__20260308_231039
#
# --- VARRD Validation Stats ---
{%- if has_edge is not none %}
# Edge:         {{ "YES" if has_edge else "NO" Github_augiemazza_varrd__strategy_template__20260308_231039
{%- endif %}
{%- if win_rate is not none %}
# Win Rate:     {{ "%.1f"|format(win_rate * 100) Github_augiemazza_varrd__strategy_template__20260308_231039%
{%- endif %}
{%- if sharpe is not none %}
# Sharpe:       {{ "%.2f"|format(sharpe) Github_augiemazza_varrd__strategy_template__20260308_231039
{%- endif %}
{%- if ev_per_trade is not none %}
# EV/Trade:     {{ "%.2f"|format(ev_per_trade) Github_augiemazza_varrd__strategy_template__20260308_231039%
{%- endif %}
{%- if profit_factor is not none %}
# Profit Factor: {{ "%.2f"|format(profit_factor) Github_augiemazza_varrd__strategy_template__20260308_231039
{%- endif %}
{%- if total_trades is not none %}
# Total Trades: {{ total_trades Github_augiemazza_varrd__strategy_template__20260308_231039
{%- endif %}
{%- if risk_reward is not none %}
# Risk/Reward:  {{ "%.2f"|format(risk_reward) Github_augiemazza_varrd__strategy_template__20260308_231039
{%- endif %}
{%- if stop_loss_atr is not none %}
# Stop Loss:    {{ "%.1f"|format(stop_loss_atr) Github_augiemazza_varrd__strategy_template__20260308_231039x ATR
{%- endif %}
{%- if take_profit_atr is not none %}
# Take Profit:  {{ "%.1f"|format(take_profit_atr) Github_augiemazza_varrd__strategy_template__20260308_231039x ATR
{%- endif %}
{%- if selected_horizon is not none %}
# Horizon:      {{ selected_horizon Github_augiemazza_varrd__strategy_template__20260308_231039 bars
{%- endif %}
{%- if explanation %}
#
{{ explanation Github_augiemazza_varrd__strategy_template__20260308_231039
{%- endif %}
# --------------------------------

from freqtrade.strategy import IStrategy, IntParameter, DecimalParameter
from freqtrade.persistence import Trade
import pandas as pd
import numpy as np
import talib.abstract as ta


{{ timeframe_to_seconds_func Github_augiemazza_varrd__strategy_template__20260308_231039


class {{ strategy_class Github_augiemazza_varrd__strategy_template__20260308_231039(IStrategy):
    """
    {{ hypothesis_name Github_augiemazza_varrd__strategy_template__20260308_231039

    Generated by VARRD — statistically validated before deployment.
    https://varrd.com
    """

    INTERFACE_VERSION = 3

    timeframe = "{{ timeframe Github_augiemazza_varrd__strategy_template__20260308_231039"

    # Disable ROI — exits handled by custom_exit
    minimal_roi = {"0": 100}

    stoploss = {{ default_stoploss Github_augiemazza_varrd__strategy_template__20260308_231039

    # Trailing stop disabled — using ATR-based custom stoploss
    trailing_stop = False
    use_custom_stoploss = {{ use_custom_stoploss Github_augiemazza_varrd__strategy_template__20260308_231039

    process_only_new_candles = True
    use_exit_signal = False
    startup_candle_count: int = {{ startup_candles Github_augiemazza_varrd__strategy_template__20260308_231039

    can_short = {{ can_short Github_augiemazza_varrd__strategy_template__20260308_231039

    def populate_indicators(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
        # ATR for stop-loss / take-profit calculations
        dataframe["atr"] = ta.ATR(dataframe, timeperiod=14)

        # --- VARRD setup_code (translated) ---
        {{ indicators_code Github_augiemazza_varrd__strategy_template__20260308_231039

        return dataframe

    def populate_entry_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
        # --- VARRD formula (translated) ---
        {{ entry_code Github_augiemazza_varrd__strategy_template__20260308_231039

        return dataframe

    def populate_exit_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
        # Exits handled by custom_exit (ATR take-profit + time limit)
        return dataframe

{{ custom_stoploss_code Github_augiemazza_varrd__strategy_template__20260308_231039

{{ custom_exit_code Github_augiemazza_varrd__strategy_template__20260308_231039
