feat: Add strategy guide page with trading workflow and scanner integration
This commit is contained in:
parent
31af0f6a02
commit
55c23b44bb
@ -694,6 +694,126 @@ def trading_system_page():
|
||||
except Exception as e:
|
||||
st.error(f"Error updating portfolio value: {str(e)}")
|
||||
|
||||
def strategy_guide_page():
|
||||
st.header("Trading Strategy Guide")
|
||||
|
||||
# Pre-Market Section
|
||||
with st.expander("1. Pre-Market Preparation (Night Before)", expanded=True):
|
||||
st.markdown("""
|
||||
* Run SunnyBands Screener (Daily Timeframe)
|
||||
* Add strong setups to watchlist
|
||||
* Focus on:
|
||||
- Stocks near key SunnyBands levels
|
||||
- SMA crossovers
|
||||
- RSI confirmation
|
||||
* Mark key levels:
|
||||
- Support
|
||||
- Resistance
|
||||
- Potential breakout zones
|
||||
* Set price alerts
|
||||
""")
|
||||
|
||||
if st.button("Run Daily SunnyBands Scan"):
|
||||
with st.spinner("Running scanner..."):
|
||||
try:
|
||||
signals = run_technical_scanner(
|
||||
scanner_choice="sunnybands",
|
||||
start_date=datetime.now().strftime("%Y-%m-%d"),
|
||||
end_date=datetime.now().strftime("%Y-%m-%d"),
|
||||
min_price=5.0,
|
||||
max_price=100.0,
|
||||
min_volume=500000,
|
||||
portfolio_size=100000.0,
|
||||
interval="1d"
|
||||
)
|
||||
if signals:
|
||||
st.success(f"Found {len(signals)} potential setups")
|
||||
for signal in signals:
|
||||
with st.expander(f"{signal['ticker']} Setup"):
|
||||
col1, col2 = st.columns(2)
|
||||
with col1:
|
||||
st.metric("Price", f"${signal['entry_price']:.2f}")
|
||||
st.metric("Volume", f"{signal['volume']:,}")
|
||||
with col2:
|
||||
st.metric("Stop Loss", f"${signal['stop_loss']:.2f}")
|
||||
st.metric("Target", f"${signal['target_price']:.2f}")
|
||||
except Exception as e:
|
||||
st.error(f"Error running scanner: {str(e)}")
|
||||
|
||||
# Morning Trading Section
|
||||
with st.expander("2. Trading Strategy (6:30-7:30 AM PST)"):
|
||||
st.markdown("""
|
||||
**Objective:** Capture early momentum plays
|
||||
|
||||
**Best Setups:**
|
||||
1. Gap and Go
|
||||
- Stock gaps up with high volume
|
||||
- Breaks pre-market high
|
||||
2. Opening Range Breakout (ORB)
|
||||
- 5-15 min consolidation
|
||||
- Clean breakout
|
||||
3. Pullback to Key Support
|
||||
- Dips to major MA or VWAP
|
||||
- Shows bounce potential
|
||||
|
||||
**Rules:**
|
||||
* Focus on 2x+ relative volume
|
||||
* Tight stops (1-2% max)
|
||||
* Partial exits at 3-5%
|
||||
* Avoid chasing gaps
|
||||
""")
|
||||
|
||||
# Midday Trading Section
|
||||
with st.expander("2. Trading Strategy (12:00-1:00 PM PST)"):
|
||||
st.markdown("""
|
||||
**Objective:** Identify clear trends for swing trades
|
||||
|
||||
**Best Setups:**
|
||||
1. Trend Continuation
|
||||
- Holding above VWAP/SMA50
|
||||
- Shows consistent strength
|
||||
2. Reversal Entry
|
||||
- RSI/MACD divergence
|
||||
- Near SunnyBands lower level
|
||||
3. Breakout Retest
|
||||
- Morning breakout
|
||||
- Clean retest of level
|
||||
|
||||
**Rules:**
|
||||
* Confirm morning runners
|
||||
* Wait for pattern confirmation
|
||||
* Clear stop loss placement
|
||||
* Focus on SunnyBands levels
|
||||
""")
|
||||
|
||||
# Execution Rules Section
|
||||
with st.expander("4. Trade Execution Rules"):
|
||||
st.markdown("""
|
||||
* Risk Management:
|
||||
- 1-2% account risk per trade
|
||||
- No overleverage
|
||||
* Order Types:
|
||||
- Use limit orders for entries
|
||||
- Set OCO orders for exits
|
||||
* Position Management:
|
||||
- Follow stop-loss plan
|
||||
- Take partial profits at 5-10%
|
||||
- Trail stops on runners
|
||||
""")
|
||||
|
||||
# Review Section
|
||||
with st.expander("5. Post-Trading Review"):
|
||||
st.markdown("""
|
||||
* Journal every trade
|
||||
* Review performance
|
||||
* Check scanner results
|
||||
* Refine strategies
|
||||
""")
|
||||
|
||||
if st.button("Add Trade Review"):
|
||||
st.session_state.page = "Trading Journal"
|
||||
st.experimental_rerun()
|
||||
|
||||
def main():
|
||||
st.set_page_config(page_title="Trading System", layout="wide")
|
||||
init_session_state()
|
||||
@ -702,14 +822,16 @@ def main():
|
||||
st.sidebar.title("Navigation")
|
||||
st.session_state.page = st.sidebar.radio(
|
||||
"Go to",
|
||||
["Trading Journal", "Technical Scanner", "CANSLIM Screener", "Trading System"]
|
||||
["Strategy Guide", "Trading Journal", "Technical Scanner", "CANSLIM Screener", "Trading System"]
|
||||
)
|
||||
|
||||
# Create necessary tables
|
||||
create_trades_table()
|
||||
|
||||
# Display selected page
|
||||
if st.session_state.page == "Trading Journal":
|
||||
if st.session_state.page == "Strategy Guide":
|
||||
strategy_guide_page()
|
||||
elif st.session_state.page == "Trading Journal":
|
||||
trading_journal_page()
|
||||
elif st.session_state.page == "Technical Scanner":
|
||||
technical_scanner_page()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user