How to get account equity at start of each month **ONLY**. Need it for lotsize calculations.

 
Problem description:
1)I want to get the account equity at the start of each month.
eg:
-If it was 20th may, I would want to get the equity on 1st may.

-If it was 1st june, I will get the equity on that day.

I want to do a variable lotsize calculation based on the equity at the start of each month.

----------------------------------

Think of a "High[]" but instead of scanning a bar, it searches the account history. Based on some of the searched posts, it seems there is no way to do this.

  1. I cannot just do a i=AccountEquity(); because equity changes all the time.
  2. I cannot put it in a global variable because it might disappear if the terminal is dead. Besides it's not a good idea because you can't move computers.

The popular option as I understand it is to scan the account history. But this raises a few question:

  1. How do you set the account history to a custom date automatically (without human intervention). I can't find any documentation on this.
  2. How do you check account equity on that particular day. You can check parameters like open time, sl, or even profit/loss. But you can't check equity.

Is writing the data into an external file the only option I have in order to achieve what I want to do? I have no issues reading up if I know where the article is. But I don't... and I'm not a programmer. I never was until about 3 weeks ago. A lot of the discussion in the searched posts are very difficult for me to understand. Plus it doesn't address the issue that I have.

 
thelws:


1.How do you set the account history to a custom date automatically (without human intervention). I can't find any documentation on this.



https://www.mql5.com/en/forum/150510


thelws:


2.How do you check account equity on that particular day. You can check parameters like open time, sl, or even profit/loss. But you can't check equity.


you need to find each order (OrdersTotal and OrdersHistoryTotal) that was\is open at that date and time (start of the month) and calculate how much the profit was


thelws:

and I'm not a programmer. I never was until about 3 weeks ago. A lot of the discussion in the searched posts are very difficult for me to understand.
this can be a problem
 
and I'm not a programmer
Same here.
 
thelws:
Problem description:
1)I want to get the account equity at the start of each month.
eg:
-If it was 20th may, I would want to get the equity on 1st may.

-If it was 1st june, I will get the equity on that day.

I want to do a variable lotsize calculation based on the equity at the start of each month.

----------------------------------

Think of a "High[]" but instead of scanning a bar, it searches the account history. Based on some of the searched posts, it seems there is no way to do this.

  1. I cannot just do a i=AccountEquity(); because equity changes all the time.
  2. I cannot put it in a global variable because it might disappear if the terminal is dead. Besides it's not a good idea because you can't move computers.

The popular option as I understand it is to scan the account history. But this raises a few question:

  1. How do you set the account history to a custom date automatically (without human intervention). I can't find any documentation on this.
  2. How do you check account equity on that particular day. You can check parameters like open time, sl, or even profit/loss. But you can't check equity.

Is writing the data into an external file the only option I have in order to achieve what I want to do? I have no issues reading up if I know where the article is. But I don't... and I'm not a programmer. I never was until about 3 weeks ago. A lot of the discussion in the searched posts are very difficult for me to understand. Plus it doesn't address the issue that I have.

The answer really depends upon your programming skills which you don't have much. The easiest solution would be using GlobalVariableSet() -its about the same effect as writing to file-. Every 1st of the month you save the equity at that time.

If you want to know the Balance (not equity) on 1st of the month without having that value saved then use WHRoeder's method posted in the link provided by qjol.

If you want to know the actual Equity then try searching on methods for calculating MAE/MFE. A little more involved and the results might be an estimate.

 
Let me read up on those posts again. They are the same ones which I had problems understanding. But let me go at it again. I'll be back if there are other questions :)
 

I've decided to forgo full automation and make things partially automated. Most of the solutions recommended are somewhat way above my level of understanding plus it's a lot of effort for something that doesn't get the job done as expected.

So I'm just going to add an "extern int" that I can use to set my account equity. Spending 5 manual mins a month isn't too bad of a solution at all.

Plus it only needs 1 extra line of code. Definitely a much more elegant solution.

Reason: