Stop runs inside fair value gaps

Three chart indicators together: mark every Stop Run marker that prints inside a gap FVG drew, coloured by the marker's side, recolour the candle when the gap and the stop run agree on direction, and count the agreeing bars in the panel. Every marker is its own alert. Needs FVG and Stop Run on the chart.

//@xfscript 1
indicator("Stop Runs In Gaps")

let buy_color: color = input.color("#22C55E", "buyColor", "Buy side")
let sell_color: color = input.color("#EF4444", "sellColor", "Sell side")

let ready: bool = fvg.available() && stop_run.available() && stop_run.count() > 0
let run_price: float = stop_run.price(0)
let run_side: side = stop_run.side(0)
let gap: int = fvg.at(run_price)
let in_gap: bool = ready && gap >= 0
let agrees: bool = in_gap && fvg.side(gap) == run_side

plot.marker(in_gap && run_side == "BUY", run_price, buy_color, "circle", "below", 11, 2)
plot.marker(in_gap && run_side == "SELL", run_price, sell_color, "circle", "above", 11, 2)
plot.candle_color(agrees && run_side == "BUY", buy_color, 0.6)
plot.candle_color(agrees && run_side == "SELL", sell_color, 0.6)

var agreeing: float = 0
agreeing := nz(agreeing[1], 0)
if agrees {
  agreeing := agreeing + 1
}
plot.panel_line(agreeing, "#E5E7EB", 2, "solid")

if fvg.available() && stop_run.available() {
  plot.label(str.concat("GAPS HERE ", format.compact(fvg.count()), "  AGREEING RUNS ", format.compact(agreeing)), "#E5E7EB")
} else {
  plot.label("ADD FVG AND STOP RUN TO THIS CHART", "#6B7280")
}

Všechny vrstvy trhu – od Orderflow po optionflow – v jednom grafu.

Orderflow data institucionální kvality s vestavěným backtestingem a obchodním deníkem. Zapište se na čekací listinu a získejte předběžný přístup.

Získat přístup