Please help this simple program

 

Please help to modify this Indicator . I'm blind about programing, so please help me out .
I need to have alert whenever the line of RSI hit 90 or hit 10 from fix scale 0 - 100 or it could be an option. The point just having alert without anycombine with other indicator. I try to delete the rest of the indicator but it won't work when I compiled it :(((( .
So just RSI it self with alert sound . Thx everybody .



/*

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

RSI with Trend Catcher signal


by Matsu
based on codes from various sources

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

*/


#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black

#property indicator_level1 70
#property indicator_level2 50
#property indicator_level3 30

int BBPrd=20;
double BBDev=2.0;
int SBPrd=13;
int SBATRPrd=21;
double SBFactor=2;
int SBShift=1;
extern int RSIPeriod=21;
extern int BullLevel=50;
extern int BearLevel=50;
extern bool AlertOn = true;

double RSI[];
double DnRSI[];
double Buy[];
double Sell[];
double Squeeze[];

int init()
{

IndicatorBuffers(5);

SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,RSI);

SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,DnRSI);

SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(2,159);
SetIndexBuffer(2,Buy);

SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(3,159);
SetIndexBuffer(3,Sell);

SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(4,159);
SetIndexBuffer(4,Squeeze);

IndicatorShortName("RSI("+RSIPeriod+")");
IndicatorDigits(2);

return(0);

}

int start()
{

int counted_bars=IndicatorCounted();
int shift,limit,ob,os;
double BBMA, SBMA, TopBBand, BotBBand, TopBBandPrev, BotBBandPrev, TopSBand, BotSBand;
bool dn = false;
double BuyNow, BuyPrevious, SellNow, SellPrevious;
static datetime prevtime = 0;


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

for (shift=limit;shift>=0;shift--)
{

RSI[shift]=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,shift);
ob = indicator_level1;
os = indicator_level3;

// ========= Two-tone RSI

if (dn==true)
{
if (RSI[shift]>BullLevel)
{
dn=false;
DnRSI[shift]=EMPTY_VALUE;
}
else
{
dn=true;
DnRSI[shift]=RSI[shift];
}

}
else
{
if (RSI[shift]<BearLevel)
{
dn=true;
DnRSI[shift]=RSI[shift];
}
else
{
dn=false;
DnRSI[shift]=EMPTY_VALUE;
}

}

// ========= Two-tone RSI Ends

// ========= Squeeze Signals

BBMA = iMA(NULL,0,BBPrd,0, MODE_SMA, PRICE_CLOSE, shift);
SBMA = iMA(NULL,0,SBPrd,0, MODE_EMA, PRICE_CLOSE, shift+SBShift);
TopBBand = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE, MODE_UPPER, shift);
BotBBand = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE,MODE_LOWER, shift);
TopSBand = SBMA + (SBFactor * iATR(NULL,0,SBATRPrd, shift+SBShift));
BotSBand = SBMA - (SBFactor * iATR(NULL,0,SBATRPrd, shift+SBShift));
TopBBandPrev = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE, MODE_UPPER, shift+0);
BotBBandPrev = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE,MODE_LOWER, shift+0);

if (TopBBand<TopSBand && BotBBand>BotSBand) Squeeze[shift]=50;

// ========= Squeeze Signals Ends

// ========= BB Breakout Signals

//if(Squeeze[shift+2]==50 && RSI[shift]>50 && BotBBand<BotSBand)
if((Squeeze[shift+2]==50 || Squeeze[shift+1]==50) && RSI[shift]>50 && BotBBand<BotSBand)
{
Buy[shift]=ob;
Sell[shift]=EMPTY_VALUE;
}
else
//if(Squeeze[shift+2]==50 && RSI[shift]<50 && TopBBand>TopSBand)
if((Squeeze[shift+2]==50 || Squeeze[shift+1]==50) && RSI[shift]<50 && TopBBand>TopSBand)
{
Buy[shift]=EMPTY_VALUE;
Sell[shift]=os;
}
else
if(Buy[shift+1]==ob && BotBBand<BotBBandPrev && RSI[shift]>50)
{
Buy[shift]=ob;
Sell[shift]=EMPTY_VALUE;
}
else
if(Sell[shift+1]==os && TopBBand>TopBBandPrev && RSI[shift]<50)
{
Buy[shift]=EMPTY_VALUE;
Sell[shift]=os;
}
else
{
Buy[shift]=EMPTY_VALUE;
Sell[shift]=EMPTY_VALUE;
}

// ========= BB Breakout Signals Ends

}

// ======= Alert =========

if(AlertOn)
{
if(prevtime == Time[0])
{
return(0);
}
prevtime = Time[0];

BuyNow = Buy[0];
BuyPrevious = Buy[1];
SellNow = Sell[0];
SellPrevious = Sell[1];

if((BuyNow ==ob) && (BuyPrevious ==EMPTY_VALUE) )
{
Alert(Symbol(), " M", Period(), " Buy Alert");
}
else
if((SellNow ==os) && (SellPrevious ==EMPTY_VALUE) )
{
Alert(Symbol(), " M", Period(), " Sell Alert");
}

IndicatorShortName("RSI("+RSIPeriod+") (Alert on)");

}

// ======= Alert Ends =========



return(0);

}

 

I can help mikemb@ittportal.net

 
Mike:

I can help mikemb@ittportal.net


How mike ? or maybe even EA for this RSi alert
 
Alet does not work in the indicator, therefore it should be simulated.
For this purpose there are many decisions:

1. To throw out in a global variable and to process its adviser

2. To cause own function of library etc.
 
Mike:
Alet does not work in the indicator, therefore it should be simulated.
For this purpose there are many decisions:

1. To throw out in a global variable and to process its adviser

2. To cause own function of library etc.

can u help me to make 1 please , doesn't matter script or ea ,  as long as having alert . plz . Thx
 
read this:

datetime GlobalVariableSet( string name, double value)
Sets a new value of the global variable. If it does not exist, the system creates a new gloabl variable. If the function succeeds, the returned value will be the last access time. Otherwise, the returned value will be 0. To get the detailed error information, one has to call the GetLastError() function.
Parameters:
name - Global variable name.
value - The new numeric value.
Sample:
  //---- try to set new value
  if(GlobalVariableSet("BarsTotal",Bars)==0)
    return(false);
//---- continue processing



end for your expert

double GlobalVariableGet( string name)
Returns the value of an existing global variable or 0 if an error occurs. To get the detailed error information, one has to call the GetLastError() function.
Parameters:
name - Global variable name.
Sample:
  double v1=GlobalVariableGet("g1");
  //---- check function call result
  if(GetLastError()!=0) return(false);
  //---- continue processing
 
Mike:
read this:

datetime GlobalVariableSet( string name, double value)
Sets a new value of the global variable. If it does not exist, the system creates a new gloabl variable. If the function succeeds, the returned value will be the last access time. Otherwise, the returned value will be 0. To get the detailed error information, one has to call the GetLastError() function.
Parameters:
name - Global variable name.
value - The new numeric value.
Sample:
  //---- try to set new value
  if(GlobalVariableSet("BarsTotal",Bars)==0)
    return(false);
//---- continue processing



end for your expert

double GlobalVariableGet( string name)
Returns the value of an existing global variable or 0 if an error occurs. To get the detailed error information, one has to call the GetLastError() function.
Parameters:
name - Global variable name.
Sample:
  double v1=GlobalVariableGet("g1");
  //---- check function call result
  if(GetLastError()!=0) return(false);
  //---- continue processing
 
I really don't know what to do with all of your format. I'm not a programmer Mike, All I know just use the indicator or ea or script , and setup the option, the rest I really don't know :( sorry .
do u have a messenger service (yahoo messenger) add me plz dvdgani2000@yahoo.com
 
dvdgani:
I really don't know what to do with all of your format. I'm not a programmer Mike, All I know just use the indicator or ea or script , and setup the option, the rest I really don't know :( sorry .
do u have a messenger service (yahoo messenger) add me plz dvdgani2000@yahoo.com
It's like the indicator i have, At my 1st post up there. It'll have alert using as indicator. I just don't like to have any other indicator but RSI itself to have alert . I tried to delete some of that format program and leave the rsi itself , but didn't work :(((((
 

check your mail

Reason: