AminHP / gym-mtsim

A general-purpose, flexible, and easy-to-use simulator alongside an OpenAI Gym trading environment for MetaTrader 5 trading platform (Approved by OpenAI Gym)
MIT License
412 stars 101 forks source link

Hi, can i define my own action space? #14

Closed yglpyn8888 closed 2 years ago

yglpyn8888 commented 2 years ago

for example , my action space has 7 discrete actions, and they correspond to 7 different positions as follows: heavy long postion (80% long position size) mid long postion (50% long position size) light long postion (30% long position size) not holding any symbols, meaning position size is 0 light short postion (30% short position size) mid short postion (50% short position size) heavy short postion (80% short position size)

In order to achieve this, what should I do?

TheSnowGuru commented 2 years ago

I would do it in another way, set parameters : Maxlotorders=10 MaxOrderLotSize=0.01

Adding 7 actions to the actions space is sounds like a bad idea...

yglpyn8888 commented 2 years ago

Hi ,@TheSnowGuru I can't find out where/what class has these parameters ? In addition, instead of ADDING 7 actions to the existing action space, I mean let the agent only do these 7 actions, which simplifies the action space and makes it easier for the agent to learn.

AminHP commented 2 years ago

You should change the action space to this:

action_space = spaces.MultiDiscrete([7 for _ in range(len(self.trading_symbols)))

And then override the _apply_actions method to work with the new structure.