# =========================================
# 1. 5-MINUTE CANDLE CLOSE
# =========================================
candle_close = 25200
strike_gap = 50
# =========================================
# 2. 3 OTM STRIKE SELECTION
# =========================================
ce_strike = candle_close + (3 * strike_gap)
pe_strike = candle_close - (3 * strike_gap)
print("CE Strike:", ce_strike)
print("PE Strike:", pe_strike)
# =========================================
# 3. PREVIOUS DAY CE PREMIUM CANDLES
# =========================================
ce_previous_day = [
{"open": 170, "high": 180, "low": 165, "close": 175},
{"open": 190, "high": 200, "low": 185, "close": 195},
{"open": 210, "high": 220, "low": 205, "close": 215}
]
# =========================================
# 4. PREVIOUS DAY PE PREMIUM CANDLES
# =========================================
pe_previous_day = [
{"open": 150, "high": 160, "low": 145, "close": 155},
{"open": 160, "high": 170, "low": 155, "close": 165},
{"open": 170, "high": 180, "low": 165, "close": 175}
# =========================================
# 5. SMA3 HIGH CALCULATION
# =========================================
ce_high_values = []
for candle in ce_previous_day:
ce_high_values.append(candle["high"])
pe_high_values = []
for candle in pe_previous_day:
pe_high_values.append(candle["high"])
ce_sma3_high = sum(ce_high_values) / len(ce_high_values)
pe_sma3_high = sum(pe_high_values) / len(pe_high_values)
print("CE SMA3 High:", ce_sma3_high)
print("PE SMA3 High:", pe_sma3_high)
# =========================================
# 6. TODAY'S SELECTED CE PREMIUM CANDLE
# =========================================
ce_current_candle = {
"open": 230,
"high": 240,
"low": 225,
"close": 235
# =========================================
# 7. TODAY'S SELECTED PE PREMIUM CANDLE
# =========================================
pe_current_candle = {
"open": 190,
"high": 200,
"low": 185,
"close": 195
# =========================================
# 8. TRADE STATUS
# =========================================
ce_trade_done = False
pe_trade_done = False
ce_trade_active = False
pe_trade_active = False
# =========================================
# 9. CE BREAKOUT AND ENTRY
# =========================================
if (
ce_current_candle["open"] > ce_sma3_high
and
ce_current_candle["close"] > ce_sma3_high
):
if ce_trade_done == False:
ce_entry = ce_current_candle["close"]
ce_stop_loss = ce_entry - 7
ce_target = ce_entry + (ce_entry * 1 / 2)
ce_trade_done = True
ce_trade_active = True
print("BUY CE")
print("CE Entry:", ce_entry)
print("CE Stop Loss:", ce_stop_loss)
print("CE Target:", ce_target)
# =========================================
# 10. PE BREAKOUT AND ENTRY
# =========================================
if (
pe_current_candle["open"] > pe_sma3_high
and
pe_current_candle["close"] > pe_sma3_high
):
if pe_trade_done == False:
pe_entry = pe_current_candle["close"]
pe_stop_loss = pe_entry - 7
pe_target = pe_entry + (pe_entry * 1 / 2)
pe_trade_done = True
pe_trade_active = True
print("BUY PE")
print("PE Entry:", pe_entry)
print("PE Stop Loss:", pe_stop_loss)
print("PE Target:", pe_target)
# =========================================
# 11. LIVE EXIT MONITORING
# =========================================
while ce_trade_active or pe_trade_active:
# Practice live premium values
ce_current_premium = 250
pe_current_premium = 210
# -------------------------
# CE EXIT
# -------------------------
if ce_trade_active:
if ce_current_premium <= ce_stop_loss:
print("CE STOP LOSS HIT")
ce_trade_active = False
elif ce_current_premium >= ce_target:
print("CE TARGET HIT")
ce_trade_active = False
# -------------------------
# PE EXIT
# -------------------------
if pe_trade_active:
if pe_current_premium <= pe_stop_loss:
print("PE STOP LOSS HIT")
pe_trade_active = False
elif pe_current_premium >= pe_target:
print("PE TARGET HIT")
pe_trade_active = False