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

How can I fix trading volume or lot size? #21

Closed TanapongAUS closed 2 years ago

TanapongAUS commented 2 years ago

May I ask, How can I fix trading volume or lot size?

thanks in advance for your answer

TanapongAUS commented 2 years ago

In addition , at first I would like to apologise for my little knowledge. But I'm quite new about using Gym MTsim. Therefore, could you please give me the example of coding to load dataframe as CSV file. And what are the names of each column that should be consisted in CSV file, so I can arrange to write my csv file properly.

Thank you

AminHP commented 2 years ago

Hi @TanapongAUS, I don't understand what you mean by "fix trading volume". What is wrong with that? Can you explain more or bring an example?

AminHP commented 2 years ago

I'm kind of busy currently, but I will try to add some examples to the repo. However, you can save the dataframe created here as CSV and see the exact value of columns and rows. Moreover, you can create a similar CSV file and load it to the simulator.

TanapongAUS commented 2 years ago

Hi @AminHP, sorry for my bad English. For "fix trading volume", in this case I mean how can I set the trading volume to become constant. for example when I set lot size(trading volume) as 0.5 Then every order will trade with volume of 0.5.

I've tried to set the trading volume and tried to run some random orders by using this code:

observation = env.reset() while True: action = env.action_space.sample() observation, reward, done, info = env.step(action)

But the trading volume sitll be random.

please give me the advice thank you

AminHP commented 2 years ago

Does this code work?

action = env.action_space.sample()
action = action.reshape(len(env.trading_symbols), -1)
action[:, -1] = 0.5
action = action.reshape(-1)
TanapongAUS commented 2 years ago

Sorry, it does not work.

with this type of error = 'MtSimulator' object has no attribute 'trading_symbols'

AminHP commented 2 years ago

Sorry, updated the code.