I haven't tried it but in my mind EAs are not designed to draw stuff on the chart, indicators are. So I draw non built-in MAs with an indicator.
You have declared but not initialized your string variables: they're empty strings (""). So the iCustom() won't know which .ex4 file to open.
I see no reason why the "indicator line" section sould be in start{} rather than in init{}.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am new with drawing objects. I have an EA that uses three moving averages for trades...
I have some issues with the strategy tester always drawing two moving average lines on the charts when I open them after a test...they are not the right ma lines...
so...
I want to add the code to my EA to make it draw the MA lines I'm using as well as place the trades...
I don't really know what I'm doing with this, when I put this code in the EA it stops placing trades in the tester....
int counted_bars=IndicatorCounted();
string ShortemaS;
string ShortemaL;
string Ctrendema;
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
while(pos>=0)
{
ExtMapBuffer1[pos]= iMA(NULL, 0, ShortemaS, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
ExtMapBuffer2[pos]= iMA(NULL, 0, ShortemaL, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
ExtMapBuffer3[pos]= iMA(NULL, 0, Ctrendema, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
pos--;
}
//---- indicator line
SetIndexStyle(0,DRAW_LINE, STYLE_SOLID, 2, Green);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE, STYLE_SOLID, 2, Yellow);
SetIndexBuffer(0,ExtMapBuffer2);
SetIndexStyle(0,DRAW_LINE, STYLE_SOLID, 2, Red);
SetIndexBuffer(0,ExtMapBuffer3);
return(0);
It doesn't draw the lines either so I know I've not got it hooked up right.
please advise.