one way i set up my code when using a moving average in an ea is like this;
adding a global variable:
PHP Code:
extern double emaperiod = 20;
and changing where you define your variable to this:
PHP Code:
double ma iMA(NULL,0,emaperiod,1,0,PRICE_CLOSE,1);
of course you can adjust this to however you want your moving average set up, but the3 purpose of doing this is that when you apply the ea, you can just change the inputs (inputs tab) to what you desire your trailing stop to be.
