How do using indicator in EA ?

 

i have a sample indicators

//+------------------------------------------------------------------+
//| IndicatorNew.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
double sonuc=0.0;
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double rest=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0);
if (rest>50) sonuc=1.5;
if (rest<50) sonuc=2.0;
if (rest==50) sonuc=3.25;



//----

//----
return(0);
}
//+------------------------------------------------------------------+

I have a EA.

//+------------------------------------------------------------------+
//| ExpertNew.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double deger=iCustom(NULL, 0, "IndicatorNew",13,1,0);
Print(deger);
//----

//----
return(0);
}
//+------------------------------------------------------------------+

i want to using indicator in my EA.

questions

1. How do change of codes Indicators.

2. How do change of codes Expert Advisor.

Thank You.

 

1 since MACD is indicators inside MT, so you can use these inside EA directory:

double rest=CD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0);
if (rest>50) sonuc=1.5;
if (rest<50) sonuc=2.0;
if (rest==50) sonuc=3.25;

2 double deger=iCustom(NULL, 0, "IndicatorNew",13,1,0); this is errors for this!!!!!, since parameter 13 has no menaing, parameter 1 is for one of databuffer, but no any buffer and no any parameter exist in your indicator "IndicatorNew", you only have a indicator file, but no any indicator data inside it, you should reference MTedit's help, and MQL4 language, and a lot of sample file on internet, atleast you shoul learn the samples bringed by MTself and try to modified them.

these two files only a sketch of file format of indicator and EA, but no useful contents in them.