PDA

View Full Version : Progressive lots sizing based on account balance and tracking balance



jami79
11-20-2012 18:08, 06:08 PM
Hey guys,

Have a question about a code.
Im hoping to use a progressive system only when my current account balance is under a'high' of my account balance.

So basically I have the following:

if (equityStart lt; AccountBalance())

equityStart = AccountBalance();


equityStart is an initial balance I have (therefore its the first'high' of my account balance. If my account balance heads south off there then it will start the progression. If some of my following trades (im not martingaling) are powerful and my account balance is higher than equityStart, then I wanted equityStart to equal the account balance then go back to the initial lot size at the development and remain there until my account balance decreases again. Basically when im at a pit using my development method.

The only issue is its not functioning https://www.nigeriaforextrading.com/attachments/1527244396.png and im not sure what code I truly must implement to get it keep an eye on everything.

Is there some formal method of coding the above?

cheers

jami79
11-05-2021 09:33, 09:33 AM
No, im not continually increasing lot sizes. Progressive was an incorrect word.
I want in order base following trades on various lot sizes in a manner that is progressive (innovative as in from commerce 2 onwards).

The innovative trades are not always increasing in size, infact they're varying.

Thank you for the answer, I see what your saying regarding the restart. Would you advoe getting around this matter?

Gamksaw
11-05-2021 10:54, 10:54 AM
Wait, so you want to boost your risk if your account goes under the account high watermark? That's a sure way to blow cash as soon as your egy is not working well and leave it to the table once the egy is in tune with the market. Just saying.

Initial thought in your code:
Your code is only going to work during that 1 case of the EA. If you restart it, then you reset the large watermark to whatever the balance is at the time in the new case.

Gamksaw
11-05-2021 12:15, 12:15 PM
No, im not always increasing lot sizes. Progressive was an incorrect word to describe it.
I would like to be able base after trades on different lot sizes in a progressive manner (innovative as in from trade 2 onwards). Still do not feel a previous trade result should impact a future trade size (out of risk scaling together with the account balance in a linear manner.) I mean, the results of a previous trade has zero effect on the possible results of a future trade, so mixing variance here can not, in theory, increase your yields over a big enough sample of transactions.

But anyhow. .


Thank you for the answer, I see what your saying regarding the resume. How would you recommend getting about that matter? Maybe shop the value as a global variable rather than a variable only used from the EA? That would address the matter with the EA re-initializing and shedding beyond high watermarks. You should have the ability to quit and restart MT4 and retain the variable. The only problem today is, porting the EA into a new set up of MT4 would start a new variable.

Other ways would be writing the value into a log file during deinit() and reading that document each time the EA starts again. That would produce the value mobile with the EA should you transfer it (plus the file) into the new MT4 instance.

(In case a more seasoned programmer knows a better way, please talk )