QuantumLearner commited on
Commit
c56468c
·
verified ·
1 Parent(s): 5b069b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -151,13 +151,14 @@ def plot_volatility_squeeze_plotly(data, ticker, show_signals=False, best_buy_pr
151
  st.plotly_chart(fig, use_container_width=True)
152
 
153
  # Sidebar layout
154
- st.sidebar.title("Configuration")
155
- st.sidebar.write("### How to Use")
156
- st.sidebar.write("""
157
- 1. Select the symbol (stock ticker or cryptocurrency pair), date range, and parameters.
158
- 2. Click 'Run Analysis' to generate the results.
159
- 3. Use the toggle inside the 'Trading Signals' section to display buy/sell signals.
160
- """)
 
161
 
162
  # Input widgets
163
  with st.sidebar.expander("Symbol Selection", expanded=True): # Open by default
@@ -165,19 +166,19 @@ with st.sidebar.expander("Symbol Selection", expanded=True): # Open by default
165
  start_date = st.date_input("Start Date", value=pd.to_datetime("2020-01-01"), help="Select the start date for the analysis.")
166
  end_date = st.date_input("End Date", value=datetime.now() + timedelta(days=1), help="Select the end date for the analysis.")
167
 
168
- with st.sidebar.expander("Analysis Parameters"):
169
  window = st.slider("Rolling Window Size", min_value=10, max_value=100, value=20, step=1, help="Window size for the rolling calculations, e.g., Bollinger Bands.")
170
  atr_mult = st.slider("ATR Multiplier", min_value=1.0, max_value=3.0, value=1.5, step=0.1, help="Multiplier for the Average True Range in the Keltner Channel calculation.")
171
  base_threshold = st.slider("Squeeze Threshold", min_value=0.005, max_value=0.05, value=0.045, step=0.005, help="Threshold for determining a squeeze condition.")
172
 
173
- with st.sidebar.expander("Confirmation Indicators"):
174
  rsi_window = st.slider("RSI Window", min_value=5, max_value=30, value=14, step=1, help="Window size for the Relative Strength Index (RSI) calculation.")
175
  macd_short = st.slider("MACD Short Period", min_value=5, max_value=20, value=12, step=1, help="Short period for the MACD calculation.")
176
  macd_long = st.slider("MACD Long Period", min_value=20, max_value=50, value=26, step=1, help="Long period for the MACD calculation.")
177
  macd_signal = st.slider("MACD Signal Period", min_value=5, max_value=20, value=9, step=1, help="Signal period for the MACD calculation.")
178
 
179
  # Trading signals expander with toggle and proximity settings
180
- with st.sidebar.expander("Trading Signals"):
181
  show_trading_signals = st.checkbox("Show Trading Signals", value=False, help="Toggle to display indicative buy and sell signals based on a trend-following strategy using volatility squeezes and proximity to Bollinger Bands. Buy signals occur when a squeeze is detected, and the price breaks above the Bollinger High band, suggesting an upward trend. Sell signals occur when the price drops below the Bollinger Low band, indicating a downward trend. Both signals allow adjustable proximity to fine-tune sensitivity.")
182
 
183
  buy_proximity_range = st.multiselect(
 
151
  st.plotly_chart(fig, use_container_width=True)
152
 
153
  # Sidebar layout
154
+ st.sidebar.title("Input Parameters")
155
+ with st.sidebar.expander("How to use", expanded=False):
156
+ st.write("### How to Use")
157
+ st.write("""
158
+ 1. Select the symbol (stock ticker or cryptocurrency pair), date range, and parameters.
159
+ 2. Click 'Run Analysis' to generate the results.
160
+ 3. Use the toggle inside the 'Trading Signals' section to display buy/sell signals.
161
+ """)
162
 
163
  # Input widgets
164
  with st.sidebar.expander("Symbol Selection", expanded=True): # Open by default
 
166
  start_date = st.date_input("Start Date", value=pd.to_datetime("2020-01-01"), help="Select the start date for the analysis.")
167
  end_date = st.date_input("End Date", value=datetime.now() + timedelta(days=1), help="Select the end date for the analysis.")
168
 
169
+ with st.sidebar.expander("Analysis Parameters", expanded=True):
170
  window = st.slider("Rolling Window Size", min_value=10, max_value=100, value=20, step=1, help="Window size for the rolling calculations, e.g., Bollinger Bands.")
171
  atr_mult = st.slider("ATR Multiplier", min_value=1.0, max_value=3.0, value=1.5, step=0.1, help="Multiplier for the Average True Range in the Keltner Channel calculation.")
172
  base_threshold = st.slider("Squeeze Threshold", min_value=0.005, max_value=0.05, value=0.045, step=0.005, help="Threshold for determining a squeeze condition.")
173
 
174
+ with st.sidebar.expander("Confirmation Indicators", expanded=False):
175
  rsi_window = st.slider("RSI Window", min_value=5, max_value=30, value=14, step=1, help="Window size for the Relative Strength Index (RSI) calculation.")
176
  macd_short = st.slider("MACD Short Period", min_value=5, max_value=20, value=12, step=1, help="Short period for the MACD calculation.")
177
  macd_long = st.slider("MACD Long Period", min_value=20, max_value=50, value=26, step=1, help="Long period for the MACD calculation.")
178
  macd_signal = st.slider("MACD Signal Period", min_value=5, max_value=20, value=9, step=1, help="Signal period for the MACD calculation.")
179
 
180
  # Trading signals expander with toggle and proximity settings
181
+ with st.sidebar.expander("Trading Signals", expanded=False):
182
  show_trading_signals = st.checkbox("Show Trading Signals", value=False, help="Toggle to display indicative buy and sell signals based on a trend-following strategy using volatility squeezes and proximity to Bollinger Bands. Buy signals occur when a squeeze is detected, and the price breaks above the Bollinger High band, suggesting an upward trend. Sell signals occur when the price drops below the Bollinger Low band, indicating a downward trend. Both signals allow adjustable proximity to fine-tune sensitivity.")
183
 
184
  buy_proximity_range = st.multiselect(