Turn the three biases on and off, then press the news buttons. A rational crowd tracks the green fundamental line; anchoring pulls the price toward 100, herding overshoots it, and loss aversion makes holders refuse to sell below what they paid.
The science
Each of N = 300 traders holds a belief b_i = (1−α)(v + σε_i) + α·A + h·(p_t − p_{t−1}): a private reading of the fundamental value v (noise ε_i, standardised to mean 0 and sd 1), an anchor A = 100 weighted by α, and a herding term that extrapolates the last price move. Desire to trade is d_i = b_i − p. Following prospect theory, a trader who wants to sell while the price is below the reference purchase price R = 100 acts on only d_i/λ of the urge (λ = 2.25 is the classic Tversky-Kahneman estimate), the disposition effect. The price moves with excess demand: p ← p + 0.3·mean(d_i) + noise.
Equilibrium is the root of the average excess demand ED(p) = mean(d_i) (bisection, shown in the lower chart). With every bias off it equals the mean belief, i.e. the fundamental value. The independent check runs the time dynamics to rest and compares with that root-finding result.
Simplifications: one risky asset, no budget limits or short-sale costs, a common reference price, a linear price-impact rule, herding applied as a first-order trend term, and constants chosen for illustration rather than fitted to market data. Educational only, not investment advice.