Four steps to a live indicator. Every other page is reference — you do not need it yet.
1
Open the Code panel
In While25, add the Code panel. It holds your workspace: a file tree on the left, an editor on the right. You install nothing, and nothing leaves your machine.
2
Create indicators/momentum.py
The class declaration decides the kind — class X(Indicator) is an indicator wherever the file sits. Folders are convention and persistence: files under indicators/, strategies/, monitors/, apps/ and plugins/ are re-registered every time the runtime starts.
3
Paste this
A dozen lines: a rolling return, drawn in its own pane under price. The chart hands the indicator its bars as while25.bars.
indicators/momentum.py
import while25
from while25 import Indicator, Plot
from while25.inputs import Int
class Momentum(Indicator):
id = "momentum"
label = "Momentum"
overlay = False # its own pane, below price
inputs = [Int("length", default=14, minimum=2)]
plots = [Plot("mom", color="#e0a34a")]
warmup = lambda params: int(params.get("length", 14))
def compute(self, ctx):
n = int(while25.params.get("length", 14))
rows = while25.bars # the chart's own series — never fetch here
if len(rows) <= n:
return None
close = [float(r["close"]) for r in rows]
# Warm-up bars have no value yet — NaN renders as a gap, 0 would be a lie.
out = [float("nan")] * n + [
(close[i] / close[i - n] - 1) * 100 for i in range(n, len(close))
]
self.times = [int(r["time"]) for r in rows] # one timestamp per value
return {"mom": out}
4
Register it, then add it to a chart
Hit Register. It now appears in the chart’s indicator picker like any built-in, and the AI can see it by name.
A strategy is the same shape
Put the file in strategies/, subclass Strategy, and decorate a method with @on.bar(symbol, interval). It places nothing until a human deploys it from the Code panel; there is no paper book.
strategies/breakout.py
import while25
from while25 import Strategy, on
SYMBOL = "EQ:US:AAPL"
class Breakout(Strategy):
id = "breakout"
@on.bar(SYMBOL, "5m")
def bar(self, ctx, bar):
if bar["close"] > bar["open"] * 1.01:
while25.buy(SYMBOL, 1, stop_loss=bar["low"]) # entry plus a stop the engine holds
The SDK itself has no dependencies, so you can write and unit-test a module on a plain Python install before it ever touches the platform. numpy and pandas are available in the runtime. Get the desktop app to run it — Python runs beside the engine, which a browser cannot host.