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....
PHP Code:
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.