Optimization including input variables from custom indicator

 

Hello guys,

I wanna run a backtest with optimization enabled for  the input variables of my EA. However, I am struggling on how to also consider  in this process the input variables of my custom indicator. Basically I want the input variables of my custom indicator to be shown the tab "Input" below:

Many thanks in advance.

 
filipe197: I want the input variables of my custom indicator to be shown the tab

So do it. Put them in your EA and pass them to your CI

 
William Roeder:

So do it. Put them in your EA and pass them to your CI

Hello again and thank you for your reply. Your suggestion makes sense and I believe this may be realy simple to execute but I am far from being an expert on this (already searched about it but without sucess). How can I load input variables defined in the EA into my custom indicator?

Thanks

 
filipe197: How can I load input variables defined in the EA into my custom indicator?

Have you read how to call iCustom? What is the fourth argument?

 
filipe197:

Hello again and thank you for your reply. Your suggestion makes sense and I believe this may be realy simple to execute but I am far from being an expert on this (already searched about it but without sucess). How can I load input variables defined in the EA into my custom indicator?

Thanks

It goes like this:

#include<Trade\Trade.mqh>
CTrade trade;

input int StopLoss;     // INSTEAD of inside the OnTick function
input int TakeProfit;
input double Lotsize;

void OnTick()
   {
        .
        .
        .
   }

Think about what many more parameters you could check against one another.

This guy explains it nicely: https://www.youtube.com/watch?v=A3l2VTLBeVM

MQL5 TUTORIAL - SIMPLE TAKE PROFIT OPTIMIZATION
MQL5 TUTORIAL - SIMPLE TAKE PROFIT OPTIMIZATION
  • 2018.05.09
  • www.youtube.com
https://mql5tutorial.comWith MQL5 for Metatrader5 we create a simple Expert Advisor to test the Take Profit value. It is a simple way to mass test a variable...
 
William Roeder:

Have you read how to call iCustom? What is the fourth argument?

I think i figured it out hou to solve thanks to your tips. So, in my EA I defined my input variables and its values and in the ICustom function I put in the 4th argument the input variables.In the Custom Indicator file I have the variables also defined, i ran the backtest and it worked ;)

Thanks