New to code

Forge API 1Updated 1 Oct 2026

What is the same

A Forge file is plain Python, and it uses only a few ideas. Each one is shown here once, with a short example. You do not need more to follow the first guide.

An import brings in what the file uses.

text
import forge as fg
from forge import param, ta

A class groups one indicator's settings and work.

text
class RsiBands(fg.Indicator):
    name = "RSI bands"

A setting is a name with a default and a range.

text
period = param.Int(14, min=2, max=200)

A method is a named piece of work. calculate is the one that fills the values.

text
def calculate(self, bars, start) -> None:
    r = ta.rsi(bars[self.source], self.period)

A comparison gives true or false for every bar at once.

text
self.out.hot[start:] = r[start:] > 70

What is different

A price chart is a list of bars, oldest first. An indicator reads that list and writes one value for each bar. The first bars stay empty until the indicator has seen enough of them, and Forge shows them empty instead of inventing a number. Forge only reads bars that have closed.

Where to start

Follow Draw your first indicator. It is one file with an RSI and two levels, and it takes about three minutes. Then write your first strategy.