Topic: How can I apply compound interest to portfolios?
Hi everyone, how can I apply compound interest to portfolios? any code for this?
Create and Test Forex Strategies
You are not logged in. Please login or register.
Forex Software → Portfolio Expert → How can I apply compound interest to portfolios?
Hi everyone, how can I apply compound interest to portfolios? any code for this?
Please contribute more to what you need.
Hello everyone, I created a specific video (in Italian), a few months ago, on how to embed the Compounding Effect on Portfolios and EAs generated with EA Studio.
For simplicity, I'll write you here the steps, so that you can apply them to MQL4 and MQL5 codes:
For MQL5
1) First step, put these 2 lines at the beginning, close to the global variables:
double capitalToCompound = AccountInfoDouble(ACCOUNT_BALANCE);
input bool compounding = true; // Compounding
2) Second step, put these lines in OpenPosition function just before ManageOrderSend, and replace "EntryAmount" with "amount" variable in the ManageOrderSend function.
double amount = Entry_Amount;
if(compounding && capitalToCompound > 0) amount = Entry_Amount*(AccountInfoDouble(ACCOUNT_EQUITY)/capitalToCompound);
amount = NormalizeDouble(amount,2);
--------------
For MQL4, the procedure is similar; the first step is identical to the MQL5.
The second step is basically modifying the "amount" variable, here's the code:
if(compounding && capitalToCompound > 0) amount = Entry_Amount*(AccountInfoDouble(ACCOUNT_EQUITY)/capitalToCompound);
amount = NormalizeDouble(amount,2);
-----------
It's not necessary to initialize the "capitalToCompound" variable in OnInit, because it's already initialized in the global variables when created.
....this is it! How to embed the "Compounding Effect", fully explained!
...Enjoy!
It is still a big question for me why there is no desire to add the % close to Lots as in Builder. I asked for this a long time ago. Maybe this is just a marketing strategy. Anyway, even with the Lots option only, the Experts Advisors Studio is fantastic. Thank you Mr Popov.
I want to share a script I developed to modify the code of an automated trading strategies portfolio. The main goal of this script is to efficiently update certain aspects of multiple strategies without having to do it manually.
Does exactly what this post says, just work in portfolio.
Forex Software → Portfolio Expert → How can I apply compound interest to portfolios?
Powered by PunBB, supported by Informer Technologies, Inc.