Use MtEnv for Reinforcement Learning
mainThe MtEnv class is an OpenAI Gym environment built on top of MtSimulator. It is designed for training RL agents.
Action Space Structure
Because stable-baselines does not support Dict or 2D Box spaces, the action space is flattened into a 1D vector of size count(trading_symbols) * (symbol_max_orders + 2).
For each symbol, the vector contains:
- Probabilities of closing existing orders (up to
symbol_max_orders). - A value for holding or creating a new order.
- The volume of the new order (positive for Buy, negative for Sell).
Note on Probabilities: The environment assumes probability values follow the logit function. The step method applies the expit function to map these values back to the $[0, 1]$ range.
Observation Space
Each observation includes:
balance,equity,margin.features: A window ofsignal_featuresof lengthwindow_size.orders: A 3D array indexed by[symbol_index, order_number, [entry_price, volume, profit]].