RSI alert + AO alert?? Is this possible? Please help.

 

Hello everyone. I'm new to the forum but have been following it for quite a long time. I need to get some help if someone is willing to help. So far I use the following for an RSI alert and it works great. I believe I got it from someone on this forum so thank you. However I need to add to it and combine it with the Awesome Oscillator (AO) indicator if possible. Specifically I only want to get an alert when the RSI hits the two levels of 70 & 30 but only when the AO reaches a certain level as well - i.e. on the EUR/USD, the RSI 70 & AO .0010 OR RSI 30 & AO -.0010. It doesn't matter what else the AO shows. Please help me if this possible. THANK YOU.


#property indicator_separate_window

#property indicator_buffers 5

//----

#property indicator_color1 Orange

#property indicator_color2 Red

#property indicator_color3 Lime

#property indicator_color4 Red

#property indicator_color5 Gold

//----

#property indicator_level1 60

#property indicator_level2 50

#property indicator_level3 40

//---- input parameters

extern int RSIPeriod=14;

extern int ApplyTo=0;

extern bool AlertMode=true;

extern int OverBought=70;

extern int OverSold=30;

//---- buffers

double RSIBuffer[];

double RSIOBBuffer[];

double RSIOSBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

string short_name;

//---- indicator lines

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,RSIBuffer);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,RSIOBBuffer);

SetIndexStyle(2,DRAW_LINE);

SetIndexBuffer(2,RSIOSBuffer);

//---- name for DataWindow and indicator subwindow label

short_name="RSI-Alert("+RSIPeriod+")";

IndicatorShortName(short_name);

SetIndexLabel(0,short_name);

SetIndexLabel(1,"OverBought");

SetIndexLabel(2,"OverSold");

//----

SetIndexDrawBegin(0,RSIPeriod);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Relative Strength Index |

//+------------------------------------------------------------------+

int start()

{

int i,counted_bars=IndicatorCounted();

//----

if(Bars<=RSIPeriod) return(0);

//----

i=Bars-RSIPeriod-1;

if(counted_bars>=RSIPeriod) i=Bars-counted_bars-1;

while(i>=0)

{

RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,ApplyTo,i);

RSIOBBuffer[i]=OverBought;

RSIOSBuffer[i]=OverSold;

i--;

}

if(AlertMode)

{

if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought)

Alert("RSI = "+ RSIBuffer[i]+ ", Sell.");

else if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold)

Alert("RSI = "+ RSIBuffer[i]+ ", Buy.");

}

//----

return(0);

}

//+------------------------------------------------------------------+

 
gemgem:

Hello everyone. I'm new to the forum but have been following it for quite a long time. I need to get some help if someone is willing to help. So far I use the following for an RSI alert and it works great. I believe I got it from someone on this forum so thank you. However I need to add to it and combine it with the Awesome Oscillator (AO) indicator if possible. Specifically I only want to get an alert when the RSI hits the two levels of 70 & 30 but only when the AO reaches a certain level as well - i.e. on the EUR/USD, the RSI 70 & AO .0010 OR RSI 30 & AO -.0010. It doesn't matter what else the AO shows. Please help me if this possible. THANK YOU.


#property indicator_separate_window

#property indicator_buffers 5

//----

#property indicator_color1 Orange

#property indicator_color2 Red

#property indicator_color3 Lime

#property indicator_color4 Red

#property indicator_color5 Gold

//----

#property indicator_level1 60

#property indicator_level2 50

#property indicator_level3 40

//---- input parameters

extern int RSIPeriod=14;

extern int ApplyTo=0;

extern bool AlertMode=true;

extern int OverBought=70;

extern int OverSold=30;

//---- buffers

double RSIBuffer[];

double RSIOBBuffer[];

double RSIOSBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

string short_name;

//---- indicator lines

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,RSIBuffer);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,RSIOBBuffer);

SetIndexStyle(2,DRAW_LINE);

SetIndexBuffer(2,RSIOSBuffer);

//---- name for DataWindow and indicator subwindow label

short_name="RSI-Alert("+RSIPeriod+")";

IndicatorShortName(short_name);

SetIndexLabel(0,short_name);

SetIndexLabel(1,"OverBought");

SetIndexLabel(2,"OverSold");

//----

SetIndexDrawBegin(0,RSIPeriod);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Relative Strength Index |

//+------------------------------------------------------------------+

int start()

{

int i,counted_bars=IndicatorCounted();

//----

if(Bars<=RSIPeriod) return(0);

//----

i=Bars-RSIPeriod-1;

if(counted_bars>=RSIPeriod) i=Bars-counted_bars-1;

while(i>=0)

{

RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,ApplyTo,i);

RSIOBBuffer[i]=OverBought;

RSIOSBuffer[i]=OverSold;

i--;

}

if(AlertMode)

{

if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought)

Alert("RSI = "+ RSIBuffer[i]+ ", Sell.");

else if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold)

Alert("RSI = "+ RSIBuffer[i]+ ", Buy.");

}

//----

return(0);

}

//+------------------------------------------------------------------+

Just use the iCustom() function to grab the AO value for a given period. You can then compare it to a specific level at the same time as the RSI values.

 
fxcourt:

Just use the iCustom() function to grab the AO value for a given period. You can then compare it to a specific level at the same time as the RSI values.

I am pretty sure I know what you are saying. I just don't know how to do that. I know very little about programming.

 
gemgem:

I am pretty sure I know what you are saying. I just don't know how to do that. I know very little about programming.

if(AlertMode)

{

double ao = iAO( NULL,0, 0 );

if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought && ao > aolevel)

Alert("RSI = "+ RSIBuffer[i]+ ", Sell.");

else if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold && ao < aolevel)

Alert("RSI = "+ RSIBuffer[i]+ ", Buy.");

}


 

if(AlertMode)

{

double ao = iAO(NULL,0,0);

if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought && ao > aolevel)

Alert("RSI = "+ RSIBuffer[i]+ ", Sell.");

else if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold && ao < aolevel)

Alert("RSI = "+ RSIBuffer[i]+ ", Buy.");

}

Reason: