one last try, wait for london to start, only trade the oppisite CHOCH not the BOS, the…
- User
one last try, wait for london to start, only trade the oppisite CHOCH not the BOS, the choch can occur anywhere doesnt matter, as long as its the first choch in the oppisite direction of the aisa breakout
Assistant
Here's the final, precise version of the strategy that:
- Only trades at the start of the London session
- Trades only the first CHoCH (not BOS) in the opposite direction of the Asia breakout
- One trade per day
- Configurable trade window (start/end of London session)
- Clear visual indicators for Asia/London sessions and trade status
✅ Final Strategy Code
//@version=5 strategy("Asia-London Breakout + CHoCH Reversal", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10) // === Session Inputs === var string G_SESSIONS = "Session Times" asia_session = input.session("2000-0000", "Asia Session", group=G_SESSIONS) london_session = input.session("0200-0500", "London Session", group=G_SESSIONS) trade_start = input.session("0200", "Start Trading At", group=G_SESSIONS) trade_end = input.session("1700", "End Trading Day At", group=G_SESSIONS) // === Strategy Inputs === var string G_STRATEGY = "Strategy Settings" take_profit_rr = input.float(1.5, "Take Profit (R:R)", minval=0.1, step=0.1, group=G_STRATEGY) stop_loss_rr = input.float(1.0, "Stop Loss (R:R)", minval=0.1, step=0.1, group=G_STRATEGY) fractal_len = input.int(2, "Fractal Length", minval=1, group=G_STRATEGY) // === Visual Settings === var string G_VISUAL = "Visual Settings" show_boxes = input.bool(true, "Show Session Boxes", group=G_VISUAL) asia_color = input.color(color.blue, "Asia Box Color", group=G_VISUAL) london_color = input.color(color.red, "London Box Color", group=G_VISUAL) box_transp = input.int(85, "Box Transparency", minval=0, maxval=100, group=G_VISUAL) // === Timezone === timezone = "America/New_York" // === Session flags === in_asia = not na(time(timeframe.period, asia_session, timezone)) in_london = not na(time(timeframe.period, london_session, timezone)) in_trade_window = timeframe.in_timeframe(timeframe.period, trade_start, trade_end, timezone) // === Track Asia session range === var float asia_high = na var float asia_low = na var bool asia_complete = false var int asia_end_bar = na if in_asia asia_high := na(asia_high) ? high : math.max(asia_high, high) asia_low := na(asia_low) ? low : math.min(asia_low, low) else if in_asia[1] // just exited Asia session asia_complete := true asia_end_bar := bar_index // Reset at new Asia session if in_asia and not in_asia[1] asia_high := high asia_low := low asia_complete := false asia_end_bar := na // === Draw Asia box === var box asia_box = na if asia_complete and show_boxes if na(asia_box) asia_box := box.new(left=asia_end_bar, top=asia_high, right=bar_index, bottom=asia_low, border_color=asia_color, bgcolor=color.new(asia_color, box_transp)) else box.set_right(asia_box, bar_index) box.set_top(asia_box, math.max(box.get_top(asia_box), high)) box.set_bottom(asia_box, math.min(box.get_bottom(asia_box), low)) else if not na(asia_box) box.delete(asia_box) asia_box := na // === Draw London box === var float london_high = na var float london_low = na var int london_start_bar = na var box london_box = na if in_london and not in_london[1] london_high := high london_low := low london_start_bar := bar_index if in_london london_high := na(london_high) ? high : math.max(london_high, high) london_low := na(london_low) ? low : math.min(london_low, low) if in_london and show_boxes if na(london_box) london_box := box.new(left=london_start_bar, top=london_high, right=bar_index, bottom=london_low, border_color=london_color, bgcolor=color.new(london_color, box_transp)) else box.set_right(london_box, bar_index) box.set_top(london_box, math.max(box.get_top(london_box), high)) box.set_bottom(london_box, math.min(box.get_bottom(london_box), low)) else if not na(london_box) box.delete(london_box) london_box := na // === Track trading state === var bool trade_taken_today = false var bool breakout_confirmed = false var bool breakout_dir_up = false var float breakout_price = na // === Reset daily flags === if in_asia and not in_asia[1] // New trading day starts with Asia session trade_taken_today := false breakout_confirmed := false breakout_dir_up := false breakout_price := na // === Detect Asia range breakout === is_3min = timeframe.period == "3" if asia_complete and not breakout_confirmed and is_3min body_high = math.max(open, close) body_low = math.min(open, close) if body_high > asia_high breakout_confirmed := true breakout_dir_up := true breakout_price := body_high else if body_low < asia_low breakout_confirmed := true breakout_dir_up := false breakout_price := body_low // === Fractals for CHoCH === bull_fractal = ta.pivothigh(high, fractal_len, fractal_len) bear_fractal = ta.pivotlow(low, fractal_len, fractal_len) // Track last fractals var float last_bull_fractal = na var float last_bear_fractal = na if bull_fractal last_bull_fractal := high[fractal_len] if bear_fractal last_bear_fractal := low[fractal_len] // === Trade Logic === can_trade = breakout_confirmed and in_london and not trade_taken_today and in_trade_window if can_trade // Only look for CHoCH in opposite direction of breakout if breakout_dir_up and ta.crossunder(close, last_bear_fractal) trade_taken_today := true stop_loss = last_bear_fractal take_profit = close - (stop_loss - close) * take_profit_rr strategy.entry("Short", strategy.short) strategy.exit("Exit Short", "Short", stop=stop_loss, limit=take_profit) if not breakout_dir_up and ta.crossover(close, last_bull_fractal) trade_taken_today := true stop_loss = last_bull_fractal take_profit = close + (close - stop_loss) * take_profit_rr strategy.entry("Long", strategy.long) strategy.exit("Exit Long", "Long", stop=stop_loss, limit=take_profit) // === Plot Status Labels === var table status = table.new(position.top_right, 4, 4) if barstate.islast table.cell(status, 0, 0, "Asia Range:", bgcolor=color.new(color.black, 100)) table.cell(status, 1, 0, asia_complete ? "Complete" : "Forming", bgcolor=color.new(color.black, 100), text_color=asia_complete ? color.green : color.gray) table.cell(status, 0, 1, "Breakout:", bgcolor=color.new(color.black, 100)) table.cell(status, 1, 1, breakout_confirmed ? (breakout_dir_up ? "UP" : "DOWN") : "Waiting", bgcolor=color.new(color.black, 100), text_color=breakout_confirmed ? (breakout_dir_up ? color.green : color.red) : color.gray) table.cell(status, 0, 2, "Can Trade:", bgcolor=color.new(color.black, 100)) table.cell(status, 1, 2, can_trade ? "Yes" : "No", bgcolor=color.new(color.black, 100), text_color=can_trade ? color.green : color.red) table.cell(status, 0, 3, "Trade Today:", bgcolor=color.new(color.black, 100)) table.cell(status, 1, 3, trade_taken_today ? "Taken" : "Waiting", bgcolor=color.new(color.black, 100), text_color=trade_taken_today ? color.green : color.gray) // === Plot Session Markers === plotshape(in_asia and show_boxes, title="Asia Session", location=location.bottom, color=color.new(asia_color, 80), style=shape.square, size=size.tiny) plotshape(in_london and show_boxes, title="London Session", location=location.bottom, color=color.new(london_color, 80), style=shape.square, size=size.tiny)
📌 Key Features:
-
Only trades at London session start
in_londonensures we only trade during London sessionin_trade_windowensures we only trade betweentrade_startandtrade_end
-
One trade per day
trade_taken_todayflag prevents multiple trades per day- Resets at the start of a new Asia session
-
Only CHoCH, not BOS
ta.crossoverandta.crossunderdetect CHoCH (not BOS)- Only considers first CHoCH in opposite direction of Asia breakout
-
Clear visual indicators
- Blue box for Asia session
- Red box for London session
- Status table showing:
- Asia range status
- Breakout direction
- Whether trade is allowed
- Whether a trade was taken today
-
Configurable trade window
trade_startandtrade_endinputs define when the strategy is active
🧠 How It Works:
- Wait for Asia session to complete
- Detect breakout (3-minute body close outside Asia range)
- Wait for London session to start
- Look for first CHoCH in opposite direction of Asia breakout
- Enter trade with SL/TP based on R:R ratio
- Only one trade per day
📌 Example:
- Asia breakout: UP → Wait for first bearish CHoCH in London
- Asia breakout: DOWN → Wait for first bullish CHoCH in London
- Trade only once per day
- Stop trading at
trade_end
📈 Input Examples:
trade_start = "0200",trade_end = "1700"fractal_len = 2(sensitive to 2-period fractals)take_profit_rr = 1.5,stop_loss_rr = 1.0
Let me know if you want to:
- Add alerts for trade entries
- Add a chart label for current status
- Include additional session boxes (e.g., NY session)
- Add risk management rules
This is the most precise version of your logic. Let me know if you want to refine it further! 🚀
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.