From e210dc7a4ab6ae7e287ef493edbc62c39ca1fba0 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Wed, 4 Feb 2026 16:33:57 -0700 Subject: [PATCH] Use returned position_type from signal generator instead of recalculating --- alpaca_trader/engine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alpaca_trader/engine.py b/alpaca_trader/engine.py index da8056f..4ef7423 100644 --- a/alpaca_trader/engine.py +++ b/alpaca_trader/engine.py @@ -991,6 +991,7 @@ def main(): if signal == 'sell' and not ENABLE_SHORT_SELLING: debug_print("Short selling disabled, ignoring sell signal") signal = None + signal_position_type = None bars = get_recent_bars(SYMBOL, 50) if bars is not None: @@ -1028,7 +1029,7 @@ def main(): entry_time = datetime.now(EASTERN) stop_loss = signal_stop_loss position_active = True - position_type = 'long' if signal == 'buy' else 'short' + position_type = signal_position_type if T1_SETTLEMENT_ENABLED and signal == 'buy': trade_amount = position_size