FlowscopeDocs

T406

duplicate handler

Severity Error

There are two handlers for the same subscription and event, for example two on chart.close blocks. Each subscription/event pair has at most one handler, so the execution order is never in doubt.

Merge both bodies into one handler.

Failing example

Flowscope Script
script "Close and delta"
data chart = subscribe(data.ohlcv)
plot c = plot.line(title: "Close")
pane p = pane(title: "Delta", height: 0.2)
plot delta = plot.columns(title: "Delta", on: p)
on chart.close {
  c.plot(chart.close)
}
on chart.close {
  delta.plot(chart.buyVolume - chart.sellVolume)
}

Fixed example

Flowscope Script
script "Close and delta"
data chart = subscribe(data.ohlcv)
plot c = plot.line(title: "Close")
pane p = pane(title: "Delta", height: 0.2)
plot delta = plot.columns(title: "Delta", on: p)
on chart.close {
  c.plot(chart.close)
  delta.plot(chart.buyVolume - chart.sellVolume)
}