Use an existing Indicator for an expert advisor

 

Hello,

is it possible to use an allready existing indicator for an expert advisor without having the sourcecode (its not a default mt5 indicator)? 

 
No. Indicators can not trade.
 

Maybe you missunderstood me.

Is it possible to make an ea which is opening and closing trades based of an existing indicator signals whithout having the sourcecode of the indicator?

 
Why would you think you can't?
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem
 
Drunkyy:

Hello,

is it possible to use an allready existing indicator for an expert advisor without having the sourcecode (its not a default mt5 indicator)? 

You can, even market indicators, just use "Market/Name of Indicator" on iCustom.
 
#resource "\\Indicators\\Example.ex5"
string    ExampleFile="\\Indicators\\Example";
    int exaHandle;
    double exaSig[];

//OnInit()
exaHandle=iCustom(_Symbol,TF,ExampleFile,9,-100,100); //9,100,100 are the params for the indicator
if(exaHandle==INVALID_HANDLE) {
        Print(TimeToString(TimeCurrent())," =====> init exaHandle failed, LN:",__LINE__);
        return(INIT_FAILED);
}

if(!ArraySetAsSeries(exaSig,true))Print(TimeToString(TimeCurrent())," =====> ArraySetAsSeries[exaSig] Error, LN:",__LINE__);

//OnTick()
ArrayResize(exaSig, totalBars);
if(CopyBuffer(exaHandle,5,0,totalBars,exaSig)<0)Print(TimeToString(TimeCurrent())," =====> CopyBuffer exaSig Error:", GetLastError()," LN:",__LINE__); // 2nd para 5 is the 5th buffer of the indicator
 
Drunkyy:

Hello,

is it possible to use an allready existing indicator for an expert advisor without having the sourcecode (its not a default mt5 indicator)? 

Alexandre Borela #:
You can, even market indicators, just use "Market/Name of Indicator" on iCustom.

This. And you have to look into how to get the right buffer numbers from an indicator.

Look into Indicators/Examples in MetaEditor and take Envelopes for example. Scroll down and see SetIndexBuffer. There the buffer numbers are defined. But even when you have no code you can just figure out which buffer number gives you certain information by having it printed. You just use the Indicator in an EA by creating a handle with iCustom and use the different buffer numbers and run it in tester, there you can compare the values with the curves that you are shown until you know which is which. Then you can use the handle for defining conditions via if/else.

Reason: