Style guide
Forge API 1Updated 1 Oct 2026
Setting names
A setting name is snake_case and at most 40 characters. Forge refuses anything else when the file loads.
pythonOpen in the editor
import forge as fg
from forge import param
FORGE_API = 1
fast_period = param.Int(20, min=5, max=60)text
FastPeriod = param.Int(20, min=5, max=60)Class names
A class name is in CapWords, and a file holds one class. Its name is the default display name.
pythonOpen in the editor
import forge as fg
FORGE_API = 1
class TrendPullback(fg.Strategy):
bars = fg.bars.Time("H1")
def compute(self, d) -> fg.Signals:
return fg.Signals(long_entry=d.close > d.open)text
class trend_pullback(fg.Strategy):File order
The file starts with import forge as fg, then the from forge import ... lines, then FORGE_API = 1, then the class.
pythonOpen in the editor
import forge as fg
from forge import param, ta
FORGE_API = 1
period = param.Int(14, min=2, max=200)text
FORGE_API = 1
import forge as fgComments
Comment what the code cannot say: why a value was chosen, or what a market does that surprises. Do not comment what the next line says.
text
# add one to the count
count = count + 1Formatting
Format files with black at its default of 88 columns. A long call breaks at its arguments.
pythonOpen in the editor
import forge as fg
from forge import param
FORGE_API = 1
slow_period = param.Int(
100, min=50, max=300, step=25, group="A group name that is long enough to wrap"
)text
slow_period = param.Int(100, min=50, max=300, step=25, group="A group name that is long enough to wrap")What is not open yet
A thing is in one of three states.
| State | What the site does |
|---|---|
| Open | Shown and linked |
| Coming soon | Named once, on the page Coming soon, with one line and no date. It has no row in the header, the docs tree, the footer columns, the dashboard menu or the status page, no page of its own, and no disabled button. The home page links to the one page in one quiet row |
| Undecided, or not for users | Not shown anywhere |