question about using indicator code with EA

 

hello,

I have programmed some indicators, but haven't used the great feature of metatrader regarding EA's including the strategy tester.

To generate an EA for the strategy tester, I copied the code from my indicator to the EA, since the EA's generally don't seem to be very different from

the indicator structure - at least looking at the program layout.

Now my custom indicator generates(in the code) a trigger signal in the form of (as an example)

if(Condition) ) {PlaySound("BUY.wav")} etc.

If I replace this code in the newly formed EA by a simple command like as the buy-condition to open a position:

OrderSend(Symbol(),OP_BUY,1,Ask,2,NULL,NULL) no orders are triggered(positions opened), no matter if using the EA live or with the stragegy tester.

As a sidemark: if one creates a simple(empty, predefined) EA and places the command OrderSend(Symbol(),OP_BUY,1,Ask,2,NULL,NULL) between

Start() and return() orders are triggered(positions opened).

So what's my (probably simple) basic mistake with the use of an EA?

thanks in advance

 

EAs dont use buffers, so indicator code wont work

you have to call your indicator with icustom from inside your EA

indicators, EAs and scripts have a totally different execution and function base

Reason: