Skip to content
Open RaamTrade

Learning sets

A strategy can ship up to five example search setups for the optimizer and the walk-forward. They live in the strategy’s own code, they are the same for every member, and the run form lists them by number: «Learning set 1» to «Learning set 5». A member picks one, changes it if they like, and runs.

The platform numbers the sets in order. A set may carry a short name that says what it does; it never carries a description or a result, and the platform shows nothing about how any of them performed.

Writing one

Each set is one line in the class body, named learning_set_1 to learning_set_5:

class CrossLessons(Strategy):
trade = Symbol()
sizing = FixedCapital()
fast = Param(10, min=2, max=100, opt_min=5, opt_max=30)
slow = Param(30, min=10, max=200, opt_min=20, opt_max=80, opt_step=5)
use_filter = Param(False)
learning_set_2 = LearningSet(
fast = Range(5, 15), # searched, inside fast's own 5..30
use_filter = True, # a switch, fixed on
)
learning_set_3 = LearningSet(
slow = Range(40, 80, 10), # searched with its own step
fast = 12, # fixed, not searched
)
def execute(self):
f = SMA(self.fast, on=self.trade)
s = SMA(self.slow, on=self.trade)
if f.value > s.value and self.trade.is_flat:
self.buy(self.trade)
elif f.value < s.value and self.trade.is_long:
self.sell(self.trade, self.trade.position)
Written Meaning
Range(from, to) Search from from to to, with the Param’s own opt_step.
Range(from, to, step) Search with this step.
Range(False, True) on a switch Search the switch both ways: off and on.
A plain value: 12, 0.5, True, "fast" Fixed at that value.
Not written As in the Param’s own ranges: searched over opt_min..opt_max, or fixed at its default when it has none.

Learning set 1

learning_set_1 is optional. Without it, learning set 1 is the strategy’s own Param ranges: every Param with opt_min/opt_max searched, everything else at its default. Write it when the first set should start somewhere else inside those ranges.

Every set — set 1 included — starts from the Param ranges and lists only what it changes.

A set’s name

A set can carry a short name, shown beside «Learning set N» on the run form: title="…", or one per language with title={"en": "…", "he": "…"}.

class NamedLessons(Strategy):
trade = Symbol()
sizing = FixedCapital()
fast = Param(10, min=2, max=100, opt_min=5, opt_max=30)
slow = Param(30, min=10, max=200, opt_min=20, opt_max=80, opt_step=5)
learning_set_2 = LearningSet(
title = {"en": "Short fast average", "he": "ממוצע מהיר קצר"},
fast = Range(5, 15),
)
def execute(self):
f = SMA(self.fast, on=self.trade)
s = SMA(self.slow, on=self.trade)
if f.value > s.value and self.trade.is_flat:
self.buy(self.trade)

The name says what the set does: what it turns on, off or fixes. It never says how good the set is, how safe or risky, whom it suits or what it earned, and it is one short line, at most 80 characters. A name is not a lesson: two sets that search the same way are still the same set, whatever they are called.

A set’s walk-forward setup

A set can also say how its walk-forward runs, with run=WalkForward(...). When a member picks the set on the walk-forward form, the form’s window settings switch to it, together with the set’s ranges. The member can change both before running.

class CrossLessonsWithWindows(Strategy):
trade = Symbol()
sizing = FixedCapital()
fast = Param(10, min=2, max=100, opt_min=5, opt_max=30)
slow = Param(30, min=10, max=200, opt_min=20, opt_max=80, opt_step=5)
learning_set_2 = LearningSet(
fast = Range(5, 15),
run = WalkForward(train="1y", test="1y", windows="rolling"),
)
learning_set_3 = LearningSet(
slow = Range(40, 80, 10),
run = WalkForward(train="2y", windows="anchored"),
)
def execute(self):
f = SMA(self.fast, on=self.trade)
s = SMA(self.slow, on=self.trade)
if f.value > s.value and self.trade.is_flat:
self.buy(self.trade)
elif f.value < s.value and self.trade.is_long:
self.sell(self.trade, self.trade.position)
Part Values On the form
train "1y" to "15y" The first training period.
test "3M", "6M" or "1y" The size of each test period.
windows "rolling" or "anchored" Rolling: every training period has the same length. Anchored: every training period starts at the beginning of the range and grows.

Every part is optional; a part you leave out stays as the form has it. Two sets with the same ranges and different setups are two different sets. The optimizer form has no windows, so it uses only the set’s ranges.

The rules

Where they appear

Only in the optimizer and the walk-forward run forms (the walk-forward setup only in the walk-forward form). A backtest, a saved strategy and a live strategy run fixed values, so learning sets play no part there. A partner’s learning sets are frozen with each release, exactly like its parameters.