PDA

View Full Version : Conversion of Indicator into EA


codersview
19-03-09, 05:37 PM
Hi All,

I got an issue with the EA of RSI and MA...

I got the indicator working properly... All I want is to convert it into EA...

I tried a couple of things. IndicatorCounted() is not working in EA, so I tried to hard-code the values of the for loop (bar=0; bar<15; bar++), I was getting correct RSI, but SMA is not giving corect values...

I'm attaching the code for SMA crossing the RSI...

So could someone please help me to convert this Indicator into EA.

************************************************** ************************************************** ***********************************
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 DarkBlue

double ExtMapBuffer1[];
double ExtMapBuffer2[];

int init()
{
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(1,ExtMapBuffer2);
return(0);
}

int deinit()
{
return(0);
}

int start()
{
int bar, limit;

int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-IndicatorCounted();


for(bar=0; bar<limit; bar++)
ExtMapBuffer1[bar] = iRSI(NULL,0,14,PRICE_TYPICAL,bar);

for(bar=0; bar<limit; bar++)
ExtMapBuffer2[bar]=iMAOnArray(ExtMapBuffer1,Bars,14,0,MODE_SMA,bar);

return(0);
}

************************************************** ************************************************** ***********************************

Thanks & Regards,
Ganesh

pippopper
27-03-09, 12:47 PM
Hi All,

I got an issue with the EA of RSI and MA...

I got the indicator working properly... All I want is to convert it into EA...

I tried a couple of things. IndicatorCounted() is not working in EA, so I tried to hard-code the values of the for loop (bar=0; bar<15; bar++), I was getting correct RSI, but SMA is not giving corect values...

I'm attaching the code for SMA crossing the RSI...

So could someone please help me to convert this Indicator into EA.

************************************************** ************************************************** ***********************************
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 DarkBlue

double ExtMapBuffer1[];
double ExtMapBuffer2[];

int init()
{
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(1,ExtMapBuffer2);
return(0);
}

int deinit()
{
return(0);
}

int start()
{
int bar, limit;

int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-IndicatorCounted();


for(bar=0; bar<limit; bar++)
ExtMapBuffer1[bar] = iRSI(NULL,0,14,PRICE_TYPICAL,bar);

for(bar=0; bar<limit; bar++)
ExtMapBuffer2[bar]=iMAOnArray(ExtMapBuffer1,Bars,14,0,MODE_SMA,bar);

return(0);
}

************************************************** ************************************************** ***********************************

Thanks & Regards,
Ganesh

Ganesh, if you find someone that will code a good system, please let me know hansm1atsainetdotcodotza. I work with two RSI's, one superimposed on the other, Good signals, but I am never here in time at the right time. Need to get this automated. the trade is invariably on the way when i am back at my computer.
thank you