Bentrix Docs
HomePricingDashboard

The three kinds of action

Discrete, continuous and order actions — what each number means, how a size becomes lots, and what a stop and a target do.

Choosing the kind

env_make takes action: discrete (the default), continuous or order. The kind decides what your agent sends to env_step and what the answer's action_space says.

KindThe agent sendsGood for
discrete0, 1 or 2DQN, PPO with a categorical policy, tabular methods — the simplest start
continuousone number in [−1, 1]policies with a Gaussian output (PPO, SAC, TD3) that also choose a size
order{side, size, stop, target}agents that set their own protective stop and target

01Discrete

ActionMeaningSize
0flat — close any position—
1longlots
2shortlots

lots is set in env_make, 0.01 by default.

02Continuous

The agent sends a target x between −1 and 1:

  • its sign is the side — above zero long, below zero short;
  • its size is the share of lots: the volume is lots × |x|, rounded to two decimals;
  • inside the deadband — |x| below deadband, 0.1 by default — the action is flat.
xWith lots = 1.0 and the default deadband
0.05flat (inside the deadband)
0.5long 0.5 lots
−0.25short 0.25 lots
1.7long 1.0 lots (sizes above 1 count as 1)

The deadband keeps a policy whose output hovers around zero from opening and closing a position on every candle.

03Order

The agent sends an object:

FieldValuesMeaning
side0, 1, 2flat, long, short
size0 to 1the share of lots
stop0 to max_pointsthe stop's distance from the entry price, in points; 0 for none
target0 to max_pointsthe target's distance, in points; 0 for none

For example {"side": 1, "size": 0.5, "stop": 200, "target": 400} opens a long of half of lots, with a stop 200 points below the ask it is filled at and a target 400 points above. The volume is rounded down to the market's volume step, and never below the market's smallest volume. Values outside their range are brought to its edge; max_points is 10,000 by default.

A stop or a target is a real order on the venue, so it can fill inside a step, while the clock moves to the next close — the next observation then shows the position gone.

04An action that keeps the side changes nothing

With every kind, an action whose side is the side already held sends nothing: holding long 0.5 lots and sending long 1.0 keeps the 0.5. The size, the stop and the target are set when a position opens. To change them, go flat for a step and open again — and pay the spread again, which is what it costs on a real venue too.

05When the venue refuses

The venue checks every order the way a broker does: the volume step, the smallest and largest volume, the stops level, the market's session. A refused order is never changed into another one; info.refused carries the sentence, and the agent stays where it was. Common causes:

  • a stop or target closer to the price than the market's stops level allows;
  • a market outside its trading session;
  • a size the account's margin cannot hold.

06A participation cap

participation, a share between 0 and 1, caps an order's units at that share of the last closed candle's volume. A larger order is cut to fit — or, if what fits is smaller than the market's least volume, refused — and impact (a number you choose) is charged to the reward, never to the account: impact × units ÷ the candle's volume. info.participation shows what was asked and what was allowed. It is a model: on a recording whose volume is a tick count rather than traded units, the cap is arithmetic, not a fact about the market.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed