Spécifications
Before you start:
In the following post you can see a project that do most that I’m asking here and can help you to understand this project:
https://www.mql5.com/ru/blogs/post/732868#comment_14662408
I would like to add more analysis to this EA in future, so would be good prepare it to this.
I would like to protect this software from unauthorized use (maybe work with license key – item E).
I need source code.
For this project I will provide you a demo account from market that I’m most interested on: (Brazil stock and future markets).
A) Data Basis: Strategies Backtest:
One by one BT Data with MAE/MFE:
- To make this project easier to understand let’s suppose that I have 5 different EAs Backtests: bt1, bt2, bt3, bt4 and bt5 (it’s an example, I can use bigger or smaller portfolios ok?). I will run BT from this 5 EA strategies in mt5 (maybe from some different EA and different pairs). This 5 BT have to have MAE and MFE information (As I know TST cache file have this informations – if you know another better way to get this information from BT you can use it). This will be the data basis for the project.
B) Consolidate Strategies Backtests inside a Portfolio by “Portfolio EA”
- For this project I will call “Portfolio EA” for the program that you must code to make all analysis.
- Inside "Portfolio EA" settings I need the option to indicate which EAs BTs to use for a Portfolio creation/analysis. This can be done by indicating a folder in “Portfolio EA” Settings, or other way better if you find one. In this example I would indicate data from item A (bt1, bt2, bt3, bt4 and bt5)
- “Portfolio EA” must run a BT (tick by tick) analyzing all Portfolio simultaneously, returning the results as a MT5 normal BT (plus some analysis explained in item D). This Portfolio BT HAVE to considerate MAE and MFE from whole portfolio, tick by tick, even if portfolio have different pairs and different timeframes.
C) Portfolio EA Settings:
- Besides Portfolio BT detailed in B, the “Portfolio EA” must have the following settings (optimizable settings):
o Max Gain to close positions;
o Max Loss to close positions;
o Max MAE to close positions;
o Max MFE to close positions;
o Profit Trailing
§ Trigger 1
§ Minimum Portfolio Gain 1
§ Trigger 2
§ Minimum Portfolio Gain 2
§ Trigger 3
§ Minimum Portfolio Gain 3
Details Regarding MAE/MFE:
The “Portfolio EA” shall allow to stipulate Gain and Loss targets for the Entire Portfolio based on MAE/MFE values, calculating minute by minute (tick by tick). If you stipulate, for example, a goal of Loss of 500 and Gain of 1000, the portfolio must be processed considering these goals (when reaching one of the goals, the portfolio is finalized on that day, moving on to the following day). At the end, the results should be presented in a graph and spreadsheet (mt5 native report)– The objective of this backtest is to find the ideal combination of portfolio gain and loss.
Details Regarding Profit Trailing:
In this settings “Portfolio EA” shall analyze tick by tick profit for the entire portfolio, and determinate new targets to close all positions according to triggers and Minimum Portfolio Gain. Let’s see an example:
o Profit Trailing
§ Trigger 1: 100
§ Minimum Portfolio Gain 1 :50
§ Trigger 2 : 200
§ Minimum Portfolio Gain 2 : 100
§ Trigger 3 : 300
§ Minimum Portfolio Gain 3 : 150
§
In the settings above when portfolio gain reach 100 (trigger1) the minimum portfolio gain is 50. If gain falls to 50, all orders for that day are closed. Otherwise if gain keep rising, and reach 200 (trigger 2) then the minimum portfolio gain is now 100. Same behavior to trigger 3.
D) Extra data analysis: OLHC, Correlation, Strategies EA evolution in graph, Monte Carlo Analysis
In Portfolio BT report explained in B, include the following analysis/reports:
OHLC:
Create a candle graph presenting MAE/MFE results showing Open, High, Low and Close (OHLC) positions. Example:
Strategies Correlation:
Present the Correlation analysis between Strategies Inside Portfolio, allowing to show daily, monthly or yearly correlation: Example:
Strategies Results presented in graph:
This would be an improvement from mt5 report. Present here the whole portfolio evolution (line blue in example) and one by one strategy evolution (other lines in example)
Monte Carlo Analysis
(https://kjtradingsystems.com/monte-carlo-probability-cones.html)
Monte Carlo analysis report to portfolio and any strategy separately. Example:
E) License
Serial key generator based in account number