Can this custom indicator ( iTrend.mq4 ) be programmed into an existing EA ...of so how would it be coded ???

 
wizkid:
??

if you are asking how to use, or call, a custom indicator, it's very simple... use the "iCustom" to define the function like this

double MyTrend=iCustom(NULL,0,"iTrend",0,0);

place the indicator in the "expert/indicator/" directory... then there is no need to specify either the path, or use the .mq4 file extension.


everything you need to know about the other values is in the MetaEditor Library. Other than that, my understanding is that trying to build the indicator into your EA like a function is a waste of time and computer resources. you do not really gain anything, terminal handles indicators and EA's differently and the processing of the indicator would chew up availability of the EA to Terminal thread. As separate files they would not conflict with each other.

 
seawolf wrote >>

if you are asking how to use, or call, a custom indicator, it's very simple... use the "iCustom" to define the function like this

place the indicator in the "expert/indicator/" directory... then there is no need to specify either the path, or use the .mq4 file extension.


everything you need to know about the other values is in the MetaEditor Library. Other than that, my understanding is that trying to build the indicator into your EA like a function is a waste of time and computer resources. you do not really gain anything, terminal handles indicators and EA's differently and the processing of the indicator would chew up availability of the EA to Terminal thread. As separate files they would not conflict with each other.

Rosh
wrote
>>
Yes, it's possible (see article Transferring an Indicator Code into an Expert Advisor Code. General Structural Schemes of an Expert Advisor and Indicator Functions), but why?

I did what you suggest and now I get this message when I compile...............'iCustom' - initialization expected C:\Program Files\Interbank FX Trader 4Demo\experts\PTTrend_201].1.mq4 (15, 16)

 

does the iTrend indicator have any input parameters?

If so, they need to be specified in the iCustom() call.

 
phy wrote >>

does the iTrend indicator have any input parameters?

If so, they need to be specified in the iCustom() call.

So the input parameters need to be specified here...double MyTrend=iCustom(NULL,0,"iTrend",0,0);

 

double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, 0,0);

All input parameters must be specified, yes. How many are there?

 
phy wrote >>

double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, 0,0);

All input parameters must be specified, yes. How many are there?

There are 7 ...So its P1 through to P7 as follows double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, P5, P6,P7, 0,0);

 
wizkid wrote >>

There are 7 ...So its P1 through to P7 as follows double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, P5, P6,P7, 0,0);

This is what I have now double MyTrend=iCustom(NULL,0,"iTrend",0,0,0,40,8,25,200,0,0)....and I stil get the same error message 'iCustom' - initialization expected C:\Program Files\Interbank FX Trader 4Demo\experts\PTTrend_201].1.mq4 (15, 16)

 

Is the name iTrend or i_Trend ?

 
phy wrote >>

Is the name iTrend or i_Trend ?

iTrend

Reason: