gym-mtsim icon indicating copy to clipboard operation
gym-mtsim copied to clipboard

A question about calculate balance

Open ruifeng96150 opened this issue 1 year ago • 3 comments

In my opinion, balance mean to cash. So when open a new order, the balance should minus cash used in orders. But in _create_hedged_order function, not update balance. It's a bug or I have misunderstand?

ruifeng96150 avatar Dec 13 '23 06:12 ruifeng96150

seq Id Symbol Type Volume Entry Time Entry Price Exit Time Exit Price Profit Margin Fee Closed
0 2 USDJPY Sell 2.0 2021-09-01 00:17:52+00:00 110.02500 2021-09-06 00:17:52+00:00 109.71200 552.355257 2000.000000 0.0100 False
1 1 GBPCAD Buy 1.0 2021-08-30 00:17:52+00:00 1.73389 2021-09-06 00:17:52+00:00 1.73626 165.225928 1375.480933 0.0003 False

And an other question. For the table above from Readme.md. How the profit and margin calcuate out? I calcuate it but not same.

ruifeng96150 avatar Dec 13 '23 08:12 ruifeng96150

In my opinion, balance mean to cash. So when open a new order, the balance should minus cash used in orders. But in _create_hedged_order function, not update balance. It's a bug or I have misunderstand?

You are referring to equity. According to Metatrader, equity is calculated as balance+profit.

AminHP avatar Dec 18 '23 14:12 AminHP

And an other question. For the table above from Readme.md. How the profit and margin calcuate out? I calcuate it but not same.

The implementations can be found here and here. There references might also help as well.

AminHP avatar Dec 18 '23 14:12 AminHP