Last edited by a moderator:
//------. . .
enum wavs { a=0, // alert.wav b=1, // alert2.wav c=2, // connect.wav d=3, // disconect.wav e=4, // ok.wav f=5, // stops.wav g=6, // news.wav }; //--- input parameters input wavs wav=a; string wavarray[7] = {"alert.wav","alert2.wav","connect.wav","disconnect.wav" }; // and so on int init() { return(0); } //------ int start() { //--- if(Ask > 1.0) { PlaySound(wavarray[wav]);} //--- return(0); } //+------------------------------------------------------------------+
So no options in Inputs then - What about playing the alert more than once as you had saidit would be best to hard code in the wavs
could it beep more than once ?anything longer than 1 second is too long
//---- if ((Ask > PriceAbove_1) && (PriceAbove_1 > 0)) { Alert("Price above the alert level 1."); PlaySound("alert.wav"); SendMail("Price for " + Symbol() + " above the alert level 1 " + Ask, "Price for " + Symbol() + " reached " + Ask + " level, which is above your alert level of 1 " + PriceAbove_1); ObjectDelete("PriceAbove_1"); PriceAbove_1= 0; } //----
then surely I can do that already - or are you suggesting a short cut menu of all the available soundshard code in the wavs
//----Very sorry but I just can't see how your proposed code works with what I have got already
.
The way I see it . . .i am not sure what you already have
#property indicator_chart_window
extern double PriceAbove_5 = 0.0; extern double PriceAbove_4 = 0.0; extern double PriceAbove_3 = 0.0; extern double PriceAbove_2 = 0.0; extern double PriceAbove_1 = 0.0; extern double PriceExact_0 = 0.0; extern double PriceBelow_1 = 0.0; extern double PriceBelow_2 = 0.0; extern double PriceBelow_3 = 0.0; extern double PriceBelow_4 = 0.0; extern double PriceBelow_5 = 0.0; enum wavs { a=0, // alert.wav b=1, // alert2.wav c=2, // connect.wav d=3, // disconect.wav e=4, // ok.wav f=5, // stops.wav g=6, // news.wav }; //+------------------------------------+ // | input parameters | //+------------------------------------+ input wavs PriceAbove_5_wav1 = a; input wavs PriceAbove_4_wav1 = a; input wavs PriceAbove_3_wav1 = a; input wavs PriceAbove_2_wav1 = a; input wavs PriceAbove_1_wav1 = a; input wavs PriceExact_0_wav1 = a; input wavs PriceBelow_1_wav1 = a; input wavs PriceBelow_2_wav1 = a; input wavs PriceBelow_3_wav1 = a; input wavs PriceBelow_4_wav1 = a; input wavs PriceBelow_5_wav1 = a; string wavarray[7] = {"alert.wav","alert2.wav","connect.wav","disconnect.wav" }; // list your wav choices in an array like this
PlaySound("alert.wav");
PlaySound(wavarray[PriceAbove_1_wav1]);
//---- #property PriceAbove_5_color5 Lime #property PriceAbove_4_color4 Lime #property PriceAbove_3_color3 Lime #property PriceAbove_2_color2 Lime #property PriceAbove_1_color1 Lime #property PriceExact_0_color0 Blue #property PriceBelow_1_color1 Red #property PriceBelow_2_color2 Red #property PriceBelow_3_color3 Red #property PriceBelow_4_color4 Red #property PriceBelow_5_color5 Red #property PriceAbove_5_width5 0 #property PriceAbove_4_width4 0 #property PriceAbove_3_width3 0 #property PriceAbove_2_width2 0 #property PriceAbove_1_width1 0 #property PriceExact_0_width0 0 #property PriceBelow_1_width1 0 #property PriceBelow_2_width2 0 #property PriceBelow_3_width3 0 #property PriceBelow_4_width4 0 #property PriceBelow_5_width5 0 #property PriceAbove_5_style5 DOT #property PriceAbove_4_style4 DOT #property PriceAbove_3_style3 DOT #property PriceAbove_2_style2 DOT #property PriceAbove_1_style1 DOT #property PriceExact_0_style0 SOLID #property PriceBelow_1_style1 DASH #property PriceBelow_2_style2 DASH #property PriceBelow_3_style3 DASH #property PriceBelow_4_style4 DASH #property PriceBelow_5_style5 DASH //----
//-----I left him a memo
#property version "1.00" #property strict #property indicator_chart_window //-------- enum wavs { a=0, // alert.wav b=1, // alert2.wav c=2, // connect.wav d=3, // disconect.wav e=4, // ok.wav f=5, // stops.wav g=6, // news.wav }; //--- input parameters input wavs PriceAbove_3_wav = c; extern double PriceAbove_3 = 0.0; extern int PriceAbove_3size = 5; extern color PriceAbove_3clr = Blue; input wavs PriceAbove_2_wav = b; extern double PriceAbove_2 = 0.0; extern int PriceAbove_2size = 2; extern color PriceAbove_2clr = Lime; input wavs PriceAbove_1_wav = a; extern double PriceAbove_1 = 0.0; extern int PriceAbove_1size = 3; extern color PriceAbove_1clr = Red; extern bool SendEmail = false; //If true e-mail is sent to the e-mail address set in your MT4. E-mail SMTP Server settings should also be configured in your MT4 string wavarray[7] = {"alert.wav","alert2.wav","connect.wav","disconnect.wav" }; // list your wav choices in an array like this int init() { //---- if (PriceAbove_3 > 0) { ObjectCreate("PriceAbove_3", OBJ_HLINE, 0, Time[0], PriceAbove_3); ObjectSet("PriceAbove_3", OBJPROP_STYLE, STYLE_DOT); ObjectSet("PriceAbove_3", OBJPROP_COLOR, PriceAbove_3clr); ObjectSet("PriceAbove_3", OBJPROP_WIDTH, PriceAbove_3size); } //---- //---- if (PriceAbove_2 > 0) { ObjectCreate("PriceAbove_2", OBJ_HLINE, 0, Time[0], PriceAbove_2); ObjectSet("PriceAbove_2", OBJPROP_STYLE, STYLE_DOT); ObjectSet("PriceAbove_2", OBJPROP_COLOR, PriceAbove_2clr); ObjectSet("PriceAbove_2", OBJPROP_WIDTH, PriceAbove_2size); } //---- if (PriceAbove_1 > 0) { ObjectCreate("PriceAbove_1", OBJ_HLINE, 0, Time[0], PriceAbove_1); ObjectSet("PriceAbove_1", OBJPROP_STYLE, STYLE_DOT); ObjectSet("PriceAbove_1", OBJPROP_COLOR, PriceAbove_1clr); ObjectSet("PriceAbove_1", OBJPROP_WIDTH, PriceAbove_1size); } //---- return(0); } int deinit() { ObjectDelete("PriceAbove_3"); ObjectDelete("PriceAbove_2"); ObjectDelete("PriceAbove_1"); //----- return(0); } //------ int start() { //--- if (ObjectGet("PriceAbove_3", 1) != PriceAbove_3) PriceAbove_3= ObjectGet("PriceAbove_3", 1); if (ObjectGet("PriceAbove_2", 1) != PriceAbove_2) PriceAbove_2= ObjectGet("PriceAbove_2", 1); if (ObjectGet("PriceAbove_1", 1) != PriceAbove_1) PriceAbove_1= ObjectGet("PriceAbove_1", 1); //---- if ((Ask > PriceAbove_3) && (PriceAbove_3 > 0)) { PlaySound(wavarray[PriceAbove_3_wav]); SendMail("Price for " + Symbol() + " above the alert level 3 " + DoubleToStr(Ask,Digits-1), "Price for " + Symbol() + " reached " + DoubleToStr(Ask,Digits-1) + " level, which is above your alert level of " + DoubleToStr(PriceAbove_3,Digits-1)); ObjectDelete("PriceAbove_3"); PriceAbove_3 = 0; } //---- if ((Ask > PriceAbove_2) && (PriceAbove_2 > 0)) { PlaySound(wavarray[PriceAbove_2_wav]); SendMail("Price for " + Symbol() + " above the alert level 2 " + DoubleToStr(Ask,Digits-1), "Price for " + Symbol() + " reached " + DoubleToStr(Ask,Digits-1) + " level, which is above your alert level of " + DoubleToStr(PriceAbove_2,Digits-1)); ObjectDelete("PriceAbove_2"); PriceAbove_2 = 0; } //---- if ((Ask > PriceAbove_1) && (PriceAbove_1 > 0)) { PlaySound(wavarray[PriceAbove_1_wav]); SendMail("Price for " + Symbol() + " above the alert level 1 " + DoubleToStr(Ask,Digits-1), "Price for " + Symbol() + " reached " + DoubleToStr(Ask,Digits-1) + " level, which is above your alert level of 1 " + DoubleToStr(PriceAbove_1,Digits-1)); ObjectDelete("PriceAbove_1"); PriceAbove_1= 0; } //---- //--- return(0); } //+------------------------------------------------------------------+
Hear what you are saying but rather than have 200 watt Yellow light bulbs I was thinking 5 watt DarkBlue on a Black background ... or something similarhundred is a traffic jam
if (PriceAbove_1 > 0) if (PriceExact_0 > 0) if (PriceBelow_1 > 0) Should it be if (PriceAbove_1 > 0) if (PriceExact_0 = 0) if (PriceBelow_1 < 0) Just my guess
I can wait a few more hoursto test your wav file and lines while the market is closed
NO ... expression not booleanCould it have anything to do with ...
//-----How does the above code differ from what I already have ?
The lines BELOW price still disappear when you click close.. Could it have anything to do with ..
.
if ((Ask > PriceBelow_1) && (PriceBelow_1 > 0))