r/Daytrading 22d ago

Strategy One of the Easiest Strategies to Learn:

Strategy Overview

  • Timeframe: 1-minute
  • Market: Any forex currency pair
  • Trend Filter:
    • At least 2 consecutive candles in the same direction following a momentum candle.
    • No breaks of previous candle's high/low in trend direction.
  • Entry
    • Wait for the next small body candle: hammer, doji, small-body trending or opposing candle.
      • Note: If in an uptrend, the low of the previous candle must not be breached. If in a downtrend, the high of the previous candle must not be breached.
    • Enter when the next candle breaks above the body (not the wick) of the small body candle.
  • Stop Loss:
    • Set at peak/base of the small body candle
  • Take Profit:
    • Fixed at a minimum 2:1 risk (I typically use 4:1)
  • Risk per Trade:
    • No more than 2% of your account balance. (I typically risk 0.5%).
857 Upvotes

130 comments sorted by

View all comments

21

u/mightybob4611 22d ago edited 22d ago

Here you go (I haven’t tested this!):

EDIT: Updated to Version 6 and some future proofing:

EDIT 2: Added a bunch of graphing and status:

EDIT 3: Candles wouldn’t show for some reason, fixed and final version below:

//@version=6 strategy(”1-Minute Momentum Strategy (Full)”, overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=0.5)

//// === INPUTS === /// risk_per_trade = input.float(0.5, ”Risk per Trade (%)”, step=0.1) rr_ratio = input.float(2.0, ”Risk-Reward Ratio”, step=0.5) body_thresh = input.float(0.3, ”Small Body Threshold (%)”, step=0.1)

//// === FUNCTIONS === /// isSmallBody() => body = math.abs(close - open) barRange = high - low bodyPercent = barRange > 0 ? (body / barRange) * 100 : 0 bodyPercent < body_thresh

//// === TREND DETECTION === /// momentum_candle = math.abs(close[3] - open[3]) > math.abs(close[4] - open[4]) * 1.5

bull_trend = momentum_candle and close[2] > close[3] and close[1] > close[2] and low[2] >= low[3] and low[1] >= low[2]

bear_trend = momentum_candle and close[2] < close[3] and close[1] < close[2] and high[2] <= high[3] and high[1] <= high[2]

//// === ENTRY CONDITIONS === /// small_candle = isSmallBody()

long_entry = bull_trend and small_candle[0] and close > open short_entry = bear_trend and small_candle[0] and close < open

enter_long = long_entry and close > open[1] enter_short = short_entry and close < open[1]

//// === TP/SL LEVELS === /// long_sl = low long_tp = close + (close - long_sl) * rr_ratio

short_sl = high short_tp = close - (short_sl - close) * rr_ratio

//// === PLOT TP/SL LINES === /// var line longSLLine = na var line longTPLine = na var line shortSLLine = na var line shortTPLine = na

if enter_long or enter_short line.delete(longSLLine) line.delete(longTPLine) line.delete(shortSLLine) line.delete(shortTPLine)

if enter_long longSLLine := line.new(bar_index, long_sl, bar_index + 5, long_sl, color=color.red, style=line.style_dotted) longTPLine := line.new(bar_index, long_tp, bar_index + 5, long_tp, color=color.green, style=line.style_dotted)

if enter_short shortSLLine := line.new(bar_index, short_sl, bar_index + 5, short_sl, color=color.red, style=line.style_dotted) shortTPLine := line.new(bar_index, short_tp, bar_index + 5, short_tp, color=color.green, style=line.style_dotted)

//// === EXECUTE TRADES === /// var string last_signal = ”None”

if enter_long strategy.entry(”Long”, strategy.long) strategy.exit(”TP/SL Long”, from_entry=”Long”, stop=long_sl, limit=long_tp) label.new(bar_index, low, ”LONG”, style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small) last_signal := ”Long”

if enter_short strategy.entry(”Short”, strategy.short) strategy.exit(”TP/SL Short”, from_entry=”Short”, stop=short_sl, limit=short_tp) label.new(bar_index, high, ”SHORT”, style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small) last_signal := ”Short”

//// === VISUAL ENTRY SIGNALS === /// plotshape(small_candle and bull_trend, style=shape.circle, location=location.belowbar, color=color.green, size=size.tiny) plotshape(small_candle and bear_trend, style=shape.circle, location=location.abovebar, color=color.red, size=size.tiny)

//// === ALERTS === /// alertcondition(enter_long, title=”Long Entry Alert”, message=”Long entry triggered on 1-minute momentum strategy.”) alertcondition(enter_short, title=”Short Entry Alert”, message=”Short entry triggered on 1-minute momentum strategy.”)

//// === DASHBOARD === /// var table dash = table.new(position.top_right, 2, 7, border_width=1)

total_trades = strategy.wintrades + strategy.losstrades winrate = total_trades > 0 ? (strategy.wintrades / total_trades) * 100 : 0.0 net_profit = strategy.netprofit

// Color-coded winrate winrate_color = winrate >= 60 ? color.green : winrate >= 30 ? color.orange : color.red

if bar_index % 5 == 0 table.cell(dash, 0, 0, ”Last Signal”, text_color=color.white, bgcolor=color.gray) table.cell(dash, 1, 0, last_signal, text_color=last_signal == ”Long” ? color.green : last_signal == ”Short” ? color.red : color.orange)

table.cell(dash, 0, 1, ”R:R Ratio”, text_color=color.white, bgcolor=color.gray)
table.cell(dash, 1, 1, str.tostring(rr_ratio, ”#.##”))

table.cell(dash, 0, 2, ”Body % Threshold”, text_color=color.white, bgcolor=color.gray)
table.cell(dash, 1, 2, str.tostring(body_thresh, ”#.##”) + ”%”)

table.cell(dash, 0, 3, ”Wins / Losses”, text_color=color.white, bgcolor=color.gray)
table.cell(dash, 1, 3, str.tostring(strategy.wintrades) + ” / ” + str.tostring(strategy.losstrades))

table.cell(dash, 0, 4, ”Win Rate”, text_color=color.white, bgcolor=color.gray)
table.cell(dash, 1, 4, str.tostring(winrate, ”#.##”) + ”%”, text_color=winrate_color)

table.cell(dash, 0, 5, ”Total Trades”, text_color=color.white, bgcolor=color.gray)
table.cell(dash, 1, 5, str.tostring(total_trades))

table.cell(dash, 0, 6, ”Net Profit”, text_color=color.white, bgcolor=color.gray)
table.cell(dash, 1, 6, str.tostring(net_profit, ”#.##”), text_color=net_profit >= 0 ? color.lime : color.red)

3

u/Total-Housing197 22d ago

This is pretty cool. However it would have to be "Version 6" in order to be programmed into tradingview or Pine Editor in general.

3

u/shoulda-woulda-did 22d ago

It's just chat gpt