changing sound alert for indicator
Posted: Thu Jun 16, 2011 1:06 pm
I found this indicator very useful especially when used in H4 or D1. what i love is this indicator also incorporate alert which is very helpful not to stick to monitor watching the chart all day long.
the problem, however, is the alert sound is the same for buy signal and sell signal.
the request is can anyone with the knowledge help me to differentiate between the alert sound for buy and sell signal? i know kreslik is full of talented trader/coder
here's the code for the indicator (the indi belongs to TRO):
//+------------------------------------------------------------------+
//| TRO_Prev_HL |
//| |
//| Copyright ? 2009, Avery T. Horton, Jr. aka TheRumpledOne |
//| |
//| PO BOX 43575, TUCSON, AZ 85733 |
//| |
//| GIFTS AND DONATIONS ACCEPTED |
//| All my indicators should be considered donationware. That is |
//| you are free to use them for your personal use, and are |
//| under no obligation to pay for them. However, if you do find |
//| this or any of my other indicators help you with your trading |
//| then any Gift or Donation as a show of appreciation is |
//| gratefully accepted. |
//| |
//| Gifts or Donations also keep me motivated in producing more |
//| great free indicators. |
//| |
//| PayPal - THERUMPLEDONE@GMAIL.COM |
//+------------------------------------------------------------------+
//| Use http://therumpledone.mbtrading.com/fx/ as your forex broker |
//| ...tell them therumpledone sent you! |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2009, Avery T. Horton, Jr. aka TRO"
#property link "http://www.therumpledone.com/"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Magenta
extern bool Send.Mail = false ;
extern bool Sound.Alert = true ;
extern int myPeriod = 1440 ;
string tHIGH0 = "HIGH_0" ;
string tLOW0 = "LOW_0" ;
string tMIDDLE1 = "MIDDLE_1" ;
datetime Trigger ;
string symbol, tChartPeriod, tShortName ;
int digits, period, digits2 ;
double point ;
bool AlertLong, AlertShort ;
//+------------------------------------------------------------------+
int init()
{
if(myPeriod == 0) { period = Period() ; } else { period = myPeriod ; }
symbol = Symbol() ;
digits = Digits ;
point = Point ;
if(digits == 5 || digits == 3) { digits = digits - 1 ; point = point * 10 ; }
string short_name="TRO_PREV_HL";
IndicatorShortName(short_name);
deinit();
return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete(tHIGH0);
ObjectDelete(tLOW0);
ObjectDelete(tMIDDLE1);
TRO() ;
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int i, dayi, counted_bars = IndicatorCounted();
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
for(i = limit - 1; i >= 0; i--)
{
double X01 = iHigh(NULL,period,i+1) ;
double X02 = iLow(NULL,period,i+1) ;
double X03 = (X01 + X02) * 0.5 ;
}
if( High[0] <= X01 ) { AlertShort = true ; } else { AlertShort = false ; }
if( Low[0] >= X02 ) { AlertLong = true ; } else { AlertLong = false ; }
DoAlert() ;
if (ObjectFind(tHIGH0) != 0)
{
ObjectCreate(tHIGH0,OBJ_ARROW,0,Time[0],X01);
ObjectSet(tHIGH0,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tHIGH0,OBJPROP_COLOR,indicator_color1);
}
else
{
ObjectMove(tHIGH0,0,Time[0],X01);
}
if (ObjectFind(tLOW0) != 0)
{
ObjectCreate(tLOW0,OBJ_ARROW,0,Time[0],X02);
ObjectSet(tLOW0,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tLOW0,OBJPROP_COLOR,indicator_color2);
}
else
{
ObjectMove(tLOW0,0,Time[0],X02);
}
if (ObjectFind(tMIDDLE1) != 0)
{
ObjectCreate(tMIDDLE1,OBJ_ARROW,0,Time[0],X03);
ObjectSet(tMIDDLE1,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tMIDDLE1,OBJPROP_COLOR,indicator_color3);
}
else
{
ObjectMove(tMIDDLE1,0,Time[0],X03);
}
return(0);
}
//+--------- TRO MODIFICATION ---------------------------------------+
void DoAlert()
{
if ( Trigger != Time[0] )
{
if( Sound.Alert )
{
if( AlertLong ) { Trigger = Time[0] ; Alert(symbol," ", " Close above previous Low " + DoubleToStr(Close[0] ,digits)); }
if( AlertShort ) { Trigger = Time[0] ; Alert(symbol," ", " Close below previous High "+ DoubleToStr(Close[0] ,digits)); }
}
if( Send.Mail )
{
if( AlertLong ) { Trigger = Time[0] ; SendMail(symbol, "Close above previous High "); }
if( AlertShort ) { Trigger = Time[0] ; SendMail(symbol, "Close below previous Low "); }
}
} // if
}
//+------------------------------------------------------------------+
void TRO()
{
string tObjName03 = "TROTAG" ;
ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL
ObjectSetText(tObjName03, CharToStr(78) , 12 , "Wingdings", DimGray );
ObjectSet(tObjName03, OBJPROP_CORNER, 3);
ObjectSet(tObjName03, OBJPROP_XDISTANCE, 5 );
ObjectSet(tObjName03, OBJPROP_YDISTANCE, 5 );
}
//+------------------------------------------------------------------+
please help
i also attached the indicator below.
the problem, however, is the alert sound is the same for buy signal and sell signal.
the request is can anyone with the knowledge help me to differentiate between the alert sound for buy and sell signal? i know kreslik is full of talented trader/coder
here's the code for the indicator (the indi belongs to TRO):
//+------------------------------------------------------------------+
//| TRO_Prev_HL |
//| |
//| Copyright ? 2009, Avery T. Horton, Jr. aka TheRumpledOne |
//| |
//| PO BOX 43575, TUCSON, AZ 85733 |
//| |
//| GIFTS AND DONATIONS ACCEPTED |
//| All my indicators should be considered donationware. That is |
//| you are free to use them for your personal use, and are |
//| under no obligation to pay for them. However, if you do find |
//| this or any of my other indicators help you with your trading |
//| then any Gift or Donation as a show of appreciation is |
//| gratefully accepted. |
//| |
//| Gifts or Donations also keep me motivated in producing more |
//| great free indicators. |
//| |
//| PayPal - THERUMPLEDONE@GMAIL.COM |
//+------------------------------------------------------------------+
//| Use http://therumpledone.mbtrading.com/fx/ as your forex broker |
//| ...tell them therumpledone sent you! |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2009, Avery T. Horton, Jr. aka TRO"
#property link "http://www.therumpledone.com/"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Magenta
extern bool Send.Mail = false ;
extern bool Sound.Alert = true ;
extern int myPeriod = 1440 ;
string tHIGH0 = "HIGH_0" ;
string tLOW0 = "LOW_0" ;
string tMIDDLE1 = "MIDDLE_1" ;
datetime Trigger ;
string symbol, tChartPeriod, tShortName ;
int digits, period, digits2 ;
double point ;
bool AlertLong, AlertShort ;
//+------------------------------------------------------------------+
int init()
{
if(myPeriod == 0) { period = Period() ; } else { period = myPeriod ; }
symbol = Symbol() ;
digits = Digits ;
point = Point ;
if(digits == 5 || digits == 3) { digits = digits - 1 ; point = point * 10 ; }
string short_name="TRO_PREV_HL";
IndicatorShortName(short_name);
deinit();
return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete(tHIGH0);
ObjectDelete(tLOW0);
ObjectDelete(tMIDDLE1);
TRO() ;
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int i, dayi, counted_bars = IndicatorCounted();
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
for(i = limit - 1; i >= 0; i--)
{
double X01 = iHigh(NULL,period,i+1) ;
double X02 = iLow(NULL,period,i+1) ;
double X03 = (X01 + X02) * 0.5 ;
}
if( High[0] <= X01 ) { AlertShort = true ; } else { AlertShort = false ; }
if( Low[0] >= X02 ) { AlertLong = true ; } else { AlertLong = false ; }
DoAlert() ;
if (ObjectFind(tHIGH0) != 0)
{
ObjectCreate(tHIGH0,OBJ_ARROW,0,Time[0],X01);
ObjectSet(tHIGH0,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tHIGH0,OBJPROP_COLOR,indicator_color1);
}
else
{
ObjectMove(tHIGH0,0,Time[0],X01);
}
if (ObjectFind(tLOW0) != 0)
{
ObjectCreate(tLOW0,OBJ_ARROW,0,Time[0],X02);
ObjectSet(tLOW0,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tLOW0,OBJPROP_COLOR,indicator_color2);
}
else
{
ObjectMove(tLOW0,0,Time[0],X02);
}
if (ObjectFind(tMIDDLE1) != 0)
{
ObjectCreate(tMIDDLE1,OBJ_ARROW,0,Time[0],X03);
ObjectSet(tMIDDLE1,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tMIDDLE1,OBJPROP_COLOR,indicator_color3);
}
else
{
ObjectMove(tMIDDLE1,0,Time[0],X03);
}
return(0);
}
//+--------- TRO MODIFICATION ---------------------------------------+
void DoAlert()
{
if ( Trigger != Time[0] )
{
if( Sound.Alert )
{
if( AlertLong ) { Trigger = Time[0] ; Alert(symbol," ", " Close above previous Low " + DoubleToStr(Close[0] ,digits)); }
if( AlertShort ) { Trigger = Time[0] ; Alert(symbol," ", " Close below previous High "+ DoubleToStr(Close[0] ,digits)); }
}
if( Send.Mail )
{
if( AlertLong ) { Trigger = Time[0] ; SendMail(symbol, "Close above previous High "); }
if( AlertShort ) { Trigger = Time[0] ; SendMail(symbol, "Close below previous Low "); }
}
} // if
}
//+------------------------------------------------------------------+
void TRO()
{
string tObjName03 = "TROTAG" ;
ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL
ObjectSetText(tObjName03, CharToStr(78) , 12 , "Wingdings", DimGray );
ObjectSet(tObjName03, OBJPROP_CORNER, 3);
ObjectSet(tObjName03, OBJPROP_XDISTANCE, 5 );
ObjectSet(tObjName03, OBJPROP_YDISTANCE, 5 );
}
//+------------------------------------------------------------------+
please help
i also attached the indicator below.