//@version=5 strategy("Amas PFT 1:1 Prop Firm Continuation & Reversal Strategy", overlay=true, initial_capital=50000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.0) // ========================================== // INPUTS & PARAMETERS // ========================================== str_mode = input.string("Both", "Trading Model", options=["Continuation", "Reversal", "Both"], group="Strategy Mode") rr_ratio = input.float(1.0, "Risk:Reward Ratio", minval=0.5, step=0.1, group="Risk Management") use_fixed_pts = input.bool(false, "Use Fixed Points for Stop Loss", group="Risk Management") fixed_sl_pts = input.float(20.0, "Fixed Stop Loss (Points)", minval=1.0, group="Risk Management") atr_period = input.int(14, "ATR Period (Dynamic SL)", minval=1, group="Risk Management") atr_mult = input.float(1.5, "ATR Multiplier", minval=0.5, step=0.1, group="Risk Management") // Continuation Parameters disp_mult = input.float(1.2, "Displacement Candle Body Multiplier", minval=0.8, step=0.1, group="Continuation Model") // Time Filter use_time_filter = input.bool(true, "Use Session Time Filter", group="Time Filter") session_time = input.session("0930-1600", "Trading Session (Exchange Time)", group="Time Filter") // ========================================== // CALCULATIONS & INDICATORS // ========================================== atr_val = ta.atr(atr_period) in_session = use_time_filter ? not na(time(timeframe.period, session_time)) : true // Candle Properties candle_body = math.abs(close - open) candle_range = high - low avg_body = ta.sma(candle_body, 20) // Fair Value Gaps (FVG) - 3 Candle Pattern // Bullish FVG: Low of candle 0 > High of candle 2 is_bull_fvg = low[0] > high[2] // Bearish FVG: High of candle 0 < Low of candle 2 is_bear_fvg = high[0] < low[2] // ========================================== // CONTINUATION MODEL (Candle Projection) // ========================================== // HTF Displacement: Body significantly larger than average body is_bull_displacement = (close[1] > open[1]) and (candle_body[1] > avg_body[1] * disp_mult) and (close[1] > high[2]) is_bear_displacement = (close[1] < open[1]) and (candle_body[1] > avg_body[1] * disp_mult) and (close[1] < low[2]) // Continuation Entry Logic: // Bullish Continuation: After bullish displacement, current price dips below open of current bar or retests FVG long_continuation = is_bull_displacement and (low < open[1] or is_bull_fvg[1]) // Bearish Continuation: After bearish displacement, current price rallies above open of current bar or retests FVG short_continuation = is_bear_displacement and (high > open[1] or is_bear_fvg[1]) // ========================================== // REVERSAL MODEL (FVG Failure / 1-2-3 C3 Model) // ========================================== // Bullish FVG created on bar[1], but Candle 3 (bar[1]) failed to close above Candle 2's high (bar[2]) -> Projects Bearish Reversal c3_failed_bull = is_bull_fvg[1] and (close[1] <= high[2]) // Bearish FVG created on bar[1], but Candle 3 (bar[1]) failed to close below Candle 2's low (bar[2]) -> Projects Bullish Reversal c3_failed_bear = is_bear_fvg[1] and (close[1] >= low[2]) long_reversal = c3_failed_bear short_reversal = c3_failed_bull // ========================================== // COMBINED SIGNALS // ========================================== long_signal = false short_signal = false if (str_mode == "Continuation" or str_mode == "Both") long_signal := long_signal or long_continuation short_signal := short_signal or short_continuation if (str_mode == "Reversal" or str_mode == "Both") long_signal := long_signal or long_reversal short_signal := short_signal or short_reversal long_condition = long_signal and in_session and strategy.position_size == 0 short_condition = short_signal and in_session and strategy.position_size == 0 // ========================================== // ORDER EXECUTION & RISK MANAGEMENT // ========================================== var float entry_sl = na var float entry_tp = na if (long_condition) sl_dist = use_fixed_pts ? fixed_sl_pts : (atr_val * atr_mult) tp_dist = sl_dist * rr_ratio entry_sl := close - sl_dist entry_tp := close + tp_dist strategy.entry("Long BaseHit", strategy.long) strategy.exit("TP/SL Long", "Long BaseHit", stop=entry_sl, limit=entry_tp) if (short_condition) sl_dist = use_fixed_pts ? fixed_sl_pts : (atr_val * atr_mult) tp_dist = sl_dist * rr_ratio entry_sl := close + sl_dist entry_tp := close - tp_dist strategy.entry("Short BaseHit", strategy.short) strategy.exit("TP/SL Short", "Short BaseHit", stop=entry_sl, limit=entry_tp) // Plot FVG & Signals plotshape(long_continuation and (str_mode != "Reversal"), title="Long Continuation", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small) plotshape(short_continuation and (str_mode != "Reversal"), title="Short Continuation", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small) plotshape(long_reversal and (str_mode != "Continuation"), title="Long Reversal", style=shape.circle, location=location.belowbar, color=color.teal, size=size.small) plotshape(short_reversal and (str_mode != "Continuation"), title="Short Reversal", style=shape.circle, location=location.abovebar, color=color.orange, size=size.small)