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

Help! Need balance history at each reward calculation #2

Closed snafu4 closed 2 years ago

snafu4 commented 2 years ago

Unsuccessfully trying to get a list of all balance values within each timestep inside of the reward method. So, at each call to _calculate_rewards(), I am trying to extract a list of all historical balances (for that timestep) - i.e. each call should add 1 historical balance.

I've tried calculating it within MtSimulator but this gets too complicated.

Poking around self.history but unable to successfully unwrap it for this.

Thanks

AminHP commented 2 years ago

Does this code do the job?

[h['balance'] for h in self.history]
snafu4 commented 2 years ago

Yes, I believe it does. Thanks!