saadrizvi09 commited on
Commit
33aeb3a
·
verified ·
1 Parent(s): 38b26a7

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +2 -1
src/streamlit_app.py CHANGED
@@ -235,8 +235,9 @@ if st.button("Run Hybrid Backtest"):
235
  test_df['Position_Size'] = (1.0 / test_df['Risk_Ratio']).clip(upper=1.0, lower=0.0)
236
 
237
  # Override: If HMM says CRASH, Size = 0
 
238
  test_df['Position_Size'] = np.where(
239
- test_df['Regime'] == high_vol_state,
240
  0.0,
241
  test_df['Position_Size']
242
  )
 
235
  test_df['Position_Size'] = (1.0 / test_df['Risk_Ratio']).clip(upper=1.0, lower=0.0)
236
 
237
  # Override: If HMM says CRASH, Size = 0
238
+ test_df['Uptrend'] = test_df['Close'] > test_df['EMA_Long']
239
  test_df['Position_Size'] = np.where(
240
+ test_df['Regime'] == high_vol_state & (test_df['Uptrend'] == False),
241
  0.0,
242
  test_df['Position_Size']
243
  )