Download MetaTrader 5

Custom indicator into EA -> not the iCustom function!

To add comments, please log in or register
Maximilian Goldbecker
159
Maximilian Goldbecker  

Hi all,

I have a custom indicator and I build an EA from it. I would like to know is there any chance to put the indicator into the EA so I would be able to sell it via the market?

Iam not talking about the iCustum function, I already use this to use it with my terminal, but nobody would be able to use it without the indicator.


Thanks for your help,

Max

Alain Verleyen
Moderator
33334
Alain Verleyen  
You need to embed it as resource. Please do some searches.
Maximilian Goldbecker
159
Maximilian Goldbecker  
Alain Verleyen:
You need to embed it as resource. Please do some searches.

Hi Alain,


thanks for your fast respond.

Do you have any good examples? Iam not really sure how to do it


Thanks in advance,

Max
Mladen Rakic
61868
Mladen Rakic  
Maximilian Goldbecker:

Hi Alain,


thanks for your fast respond.

Do you have any good examples? Iam not really sure how to do it


Thanks in advance,

Max

You could use the example provided at the link from Alain's post (this example) :

//+------------------------------------------------------------------+
//|                                                     SampleEA.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#resource "\\Indicators\\SampleIndicator.ex5"
int handle_ind;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   handle_ind=iCustom(_Symbol,_Period,"::Indicators\\SampleIndicator.ex5");
   if(handle_ind==INVALID_HANDLE)
     {
      Print("Expert: iCustom call: Error code=",GetLastError());
      return(INIT_FAILED);
     }
//--- ...
   return(INIT_SUCCEEDED);
  }

That way no external file is used and it does not need to be distributed (in the case of the example code the "SampleIndicator.ex5" does not need to exist on users PC - it is in your compiled EA)

Maximilian Goldbecker
159
Maximilian Goldbecker  
Mladen Rakic:

You could use the example provided at the link from Alain's post (this example) :

That way no external file is used and it does not need to be distributed (in the case of the example code the "SampleIndicator.ex5" does not need to exist on users PC - it is in your compiled EA)

Hi Mladen,

I red the arcticle and the example, but I didnt understand how the EA knows, e.g. with your example, how to calculate the values of the indicator?

Thanks,

Max

Mladen Rakic
61868
Mladen Rakic  
Maximilian Goldbecker:

Hi Mladen,

I red the arcticle and the example, but I didnt understand how the EA knows, e.g. with your example, how to calculate the values of the indicator?

Thanks,

Max

Post your EA and the indicator here (any EA that you have made and the indicator it is using) and then it can be shown how
Maximilian Goldbecker
159
Maximilian Goldbecker  
Mladen Rakic:
Post your EA and the indicator here (any EA that you have made and the indicator it is using) and then it can be shown how

Hi Mladen,


thanks for your help. I really appreciate it!!!


Thanks in advance!

Max

Files:
Laguerre.mq4 3 kb
Mladen Rakic
61868
Mladen Rakic  
Maximilian Goldbecker:

Hi Mladen,


thanks for your help. I really appreciate it!!!


Thanks in advance!

Max

Like this

The ex4 file already has the indicators in it - ie: you don't need the files in the indicators folder if you use the indicators as it is done in the EA now

Files:
Maximilian Goldbecker
159
Maximilian Goldbecker  
Mladen Rakic:
Like this

The ex4 file already has the indicators in it - ie: you don't need the files in the indicators folder if you use the indicators as it is done in the EA now

Thanks Mate. Your are a legend!
To add comments, please log in or register