New to code
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.
import forge as fg
from forge import param, taA class groups one indicator's settings and work.
class RsiBands(fg.Indicator):
name = "RSI bands"A setting is a name with a default and a range.
period = param.Int(14, min=2, max=200)A method is a named piece of work. calculate is the one that fills the values.
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.
self.out.hot[start:] = r[start:] > 70What 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.