1. Can a purchased Market EA analyze a purchased/rented or demo Market indicator this way?
All that you need is an ex5 indicator file, its file name, and any parameters/inputs/settings that you want to change from defaults. For example, you could insert a string input variable into an iCustom() call within OnInit() in the EA for the purpose of specifying the indicator name. You could potentially add inputs for indicator parameters as well, but that would be more challenging due to varying numbers of parameters in each indicator. This is a case where I would prompt the MT5 AI Assistant to write a Service (instead of an EA) that would temporarily load the indicator for the purpose of extracting the number and variable types of the inputs from the indicator startup window. This is not a small project and would likey take more than one workday with the Assistant.
That all assumes that you have the source code of the EA/Service. Otherwise, no.
Can a demo Market EA analyze a demo Market indicator in Visual Strategy Tester?
If the developer of the Market product specifically designed the EA to do that, yes, but otherwise no. Again, I would prompt the MT5 AI Assistant to write a Service that runs at the terminal level─instead of an EA that runs at the chart level.
If the indicator is selected only before the run, rather than known when the EA was compiled, what is the supported way to make that indicator available to the Strategy Tester agent without recompiling the EA?
You can run whatever indicator that you want through the Tester on its own but again, an ex5 that was not specifically compiled to work with that indicator can't be modified─making that impossible.
As you also mentioned coding the utility yourself, a Service is the way to go.
The only one thing that comes to my mind for analyzing an arbitrary (unknown beforehand) indicator from a standalone EA (without its recompilation/code customization) is to specify the indicator in the tester.tpl or ExactEAfileName.tpl - this assumes that all settings for the indicator will be taken from the template, not assigned by the EA. Then when the tester runs this EA in visual mode you'll use MQL5 APIs (ChartIndicatorsTotal, ChartIndicatorName, ChartIndicatorGet) to get the indicator handle on the chart and analyze its buffers. I did not test this approach.
Here is a code draft from AI (slightly polished manually):
input string WorkIndicator = "SuperTrend"; // Indicator (shortname as displayed on chart!) int myIndicatorHandle = INVALID_HANDLE; int getHandleFromChart(string shortName) { long chartId = ChartID(); const int win = (int)ChartGetInteger(chartId, CHART_WINDOWS_TOTAL); for(int subWindow = 0; subWindow < win; ++subWindow) { int totalIndicators = ChartIndicatorsTotal(chartId, subWindow); for(int i = 0; i < totalIndicators; ++i) { string indName = ChartIndicatorName(chartId, subWindow, i); if(StringFind(indName, shortName) >= 0) { int handle = ChartIndicatorGet(chartId, subWindow, indName); if(handle != INVALID_HANDLE) { Print("Handle for ", indName, " is found: ", handle); return handle; } } } } return INVALID_HANDLE; } void OnTick() { if(myIndicatorHandle == INVALID_HANDLE) { myIndicatorHandle = getHandleFromChart(WorkIndicator); if(myIndicatorHandle == INVALID_HANDLE) { return; // wait for another tick } } double buffer[]; // TODO: customize this call with buffer numbers and bar offsets to read if(CopyBuffer(myIndicatorHandle, 0, 0, 1, buffer) > 0) { // main processing goes here... } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am developing a general-purpose analysis EA for MT5.
Before a Strategy Tester run, the user selects an already installed custom indicator and supplies its path/inputs to the EA. The EA then uses documented MQL5 APIs such as iCustom/IndicatorCreate, BarsCalculated and CopyBuffer to analyze the indicator in Visual Strategy Tester.
Is this supported when the selected indicator is an MQL5 Market product?
In particular:
Can a purchased Market EA analyze a purchased/rented or demo Market indicator this way?
Can a demo Market EA analyze a demo Market indicator in Visual Strategy Tester?
If the indicator is selected only before the run, rather than known when the EA was compiled, what is the supported way to make that indicator available to the Strategy Tester agent without recompiling the EA?
No copying, modification, decryption or bypass of Market protection is intended. Both products would remain legitimate Market-installed protected products.