diff --git a/backtesting/backtest_iron_condor.py b/backtesting/backtest_iron_condor.py index 9210b3d..b86c764 100644 --- a/backtesting/backtest_iron_condor.py +++ b/backtesting/backtest_iron_condor.py @@ -126,7 +126,7 @@ def _backtest_iron_condor( else: call_spread_history = get_spread_history(historical_option_data, call_spread_strategy) put_spread_history = get_spread_history(historical_option_data, put_spread_strategy) - + current_date = call_spread_history.iloc[0].name[:10] entry_time = call_spread_strategy.trade_entry_time @@ -169,8 +169,6 @@ def _backtest_iron_condor( trades_entered = False call_spread_stopped_out = False put_spread_stopped_out = False - took_profit = False - took_early_loss = False max_profit = 0.0 max_drawdown = 0.0 @@ -256,12 +254,11 @@ def _backtest_iron_condor( if current_profit_dollars < max_drawdown: max_drawdown = current_profit_dollars - if not took_profit and not took_early_loss: - if not call_spread_stopped_out and current_call_spread_price > 0.05: + if not call_spread_stopped_out and current_call_spread_price > 0.05: premium_received -= current_call_spread_price - - if not put_spread_stopped_out and current_put_spread_price > 0.05: - premium_received -= current_put_spread_price + + if not put_spread_stopped_out and current_put_spread_price > 0.05: + premium_received -= current_put_spread_price number_of_contracts = call_spread_strategy.number_of_contracts stop_out_fees = 0.0 # It costs money to get stopped out.