MMTMMT Docs
Diagnostics

N001

value may be null here

N001

This value can be null, but a non-null value is needed here. Check it with if x != null first, or give a fallback with ?? default.

Failing example

script "conf"

data chart = subscribe(data.ohlcv)

type Signal { strength: float }

state signals: Signal[] = Signal[](4)

on chart.update {
  let s = signals.last()
  let bad = s.strength

  if s != null {
    let ok = s.strength
  }
}

Corrected example

script "fixed"
data chart = subscribe(data.ohlcv)
on chart.update { let value: float = chart.close ?? 0.0 }

On this page