Price Alert

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK
PAA_1_zps81fvsnfe.png


Needed to get this done so I can go to bed without thinking about it all night

The only thing I am thinking about is ... Number the lines ... H'mmm
.
 

hayseed

Master Trader
Jul 27, 2010
1,159
275
149
usa
Errors only came up with 2 - 1 at the top somewhere and 1 at the bottom ... should have copied them for reference
//----

hey maverick...... quite often the actual errors reported won't be the actual errors..... so it might say your missing a '}' when actually your missing a '=' ..... there are errors where it will list each one individually..... and other times it will list them only by type with no mention of how many of each type...... the more errors you have the more you will become familiar with what it means.....

you can look in the code you posted for the errors..... there are several places, like below, that need both ';' and '}' ..... maybe 4 other places only need a '}'..... the '{' in the deint section is out of place..... maybe some more..... can't remember.....

these are the same errors we all make......h

//----

MQL4:
   if ((Ask > PriceAbove_1) && (PriceAbove_1 > 0))
    {
       Alert("Price above the alert level 1.");
       PlaySound("ring.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                             [COLOR=#ff4d4d]//----  missing ;
                                                             //---- missing }[/COLOR]
 

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK
Well I decided to go back to the original plan of 5 UP and 5 down :)

Initially I had 9 errors :(

Errors_zpssf3knujm.png


Luckily they were easy ones :)

Again thank you Hayseed for your assistance - appreciated
.
 

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK
How could Maverick with a little help choose which wav files to use - I'm thinking choice of two ... Good and Bad ... Beyond me unfortunately but could it be an automatic selection depending on the trade. I wouldn't expect you to do all the work ... just guide me

If you place a BUY trade the Green lines when hit are Good for you and the Red Bad and vice versa with a SELL trade

My idea is to find/create a Good wav file for when the trade is in your favour and a BAD wav when the trade is going against you

When you are doing something else it's a feel good factor to hear money going into the bank :) On the other hand if you hear it going down the toilet :( you had better review the situation asap
.
 

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK
Forget about the previous post 69 which was a good idea at the time ... thought of possible easier solution

if ((Ask > PriceAbove_1) && (PriceAbove_1 > 0))
{
Alert("Price above the alert level 1.");
PlaySound("ring.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

Looking to have the PlaySound choice from a dropdown of available sounds in the Sound folder

Input_1_zpstvcllli8.png

Once you have decided upon the overall trend it's not something that you will be changing every five minutes once set

Been looking at the code from another EA and have come up with

MQL4:
extern SoundList Above_5 = s11;
 
enum SoundList
{
    s11=11,        //Above_5.wav
    s10=10,        //Above_4.wav
    s9=9,          //Above_3.wav  etc etc
};

Am i on the right tracks and what do i do with ?
MQL4:
PlaySound("ring.wav");
How do i tie it all together
 

hayseed

Master Trader
Jul 27, 2010
1,159
275
149
usa
How do i tie it all together

//------

hey maverick..... for PlaySound() to work effectively it must be short.... anything longer than 1 second is too long.....h

//------

MQL4:
extern double above1     =                  0.0;
extern string above1wav  =    "email.wav";   // keep sounds less than 2 seconds long
 
 
extern double below1     =                  0.0;
extern string below1wav  = "timeout.wav";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
 
//--- indicator buffers mapping
 
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
 
int start()
  {
 
   if((Ask > above1) && (above1 > 0.0)) {PlaySound(above1wav);}  // keep your sounds short
 
   if((Ask < below1) && (below1 > 0.0)) {PlaySound(below1wav);}
 
   //-----------  expand to as many lines as needed
   //-----------  be sure to limit the number of times the PlaySound() works otherwise they never stop till untrue
 
 
   return(0);
  }
 
//------

//-----
 

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK
anything longer than 1 second is too long

O'oops I was thinking along the lines of something like beep,beep,beep,beep,beep for above5 which I would make up with Audacity

But then again if I read you right I can determine how may times to play beep

.
 

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK
I have
MQL4:
//----
    if ((Ask > PriceAbove_5) && (PriceAbove_5 > 0))
    {
       Alert("Price above the alert level 5.");
       PlaySound("alert.wav");
       SendMail("Price for " + Symbol() +  " above the alert level 3 " + Ask, "Price for " + Symbol() +  " reached " + Ask + " level, which is above your alert level of " + PriceAbove_5);
       ObjectDelete("PriceAbove_5");
       PriceAbove_5 = 0;
    }
//----
at the moment ... so am i just replacing
MQL4:
PlaySound("alert.wav");
with
MQL4:
if((Ask > above1) && (above1 > 0.0)) {[URL='https://docs.mql4.com/common/PlaySound']PlaySound[/URL](above1wav);}
and presumably the 0.0 is the number of times it plays

.
 

Maverick

Master Trader
Apr 3, 2014
460
8
79
Bournemouth UK