Coding help - page 52

 

No offense but thats definetely not it...or did I oversse something? I dont see the time function, sure if you are looking at trendlines thats nice, but did you know that MT4 has price level alert already integrated? Im looking for the time function as well, only valid alert if price xxx at 12.00 for example...price might have crossed xxx at 11.30 and fully retraced it, so time function thats what Im lookin for....thanks alot

 

...

Jonny473

Try using something like this as a frame for your alerts :

//------------------------------------------------------------------

//

//------------------------------------------------------------------

#property indicator_chart_window

extern string AlertFrom = "12:00";

extern string AlertTo = "12:01";

extern bool UseBrokerTime = false;

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

//

//

int init()

{

return(0);

}

int start()

{

datetime timeToCheck;

if (UseBrokerTime)

timeToCheck = TimeCurrent();

else timeToCheck = TimeLocal();

//

//

//

//

//

string startDay = TimeToStr(timeToCheck,TIME_DATE)+" ";

datetime startTime = StrToTime(startDay+AlertFrom);

datetime endTime = StrToTime(startDay+AlertTo);

static datetime lastAlerted = 0;

//

//

//

//

//

bool condition = false; // add some condition checking here so that when condition == true alert can be raised

if (condition && lastAlerted != Time[0] && timeToCheck>= startTime && timeToCheck<=endTime)

{

lastAlerted = Time[0];

//

// add the sound and email if you wish them here

//

Alert("the alert at a certain time span");

}

return(0);

}

This one has 2 time parameters (so it allows you some "window" in whuich the alert can be triggered) and a choice of broker time or local time usage for the alert

 

coding help

Hi guys, what should i do to unlag this indicator or if somebody can pls unlag this indicator.I have attached it.Thanks

 
Jonny473:
No offense but thats definetely not it...or did I oversse something? I dont see the time function, sure if you are looking at trendlines thats nice, but did you know that MT4 has price level alert already integrated? Im looking for the time function as well, only valid alert if price xxx at 12.00 for example...price might have crossed xxx at 11.30 and fully retraced it, so time function thats what Im lookin for....thanks alot

No offence taken, don't worry! Your request does seem a little bizarre though, if you have such a specific time, why not just look at the chart at that time?

Also the line alert I pointed to has an alert at next bar function, meaning you could set it on an hour chart but i'm not sure if that takes the price cross at 12:00 or any cross during the preceding hour. If you mean, only crosses in the first minute of 12:00 then I say again just look at the chart on a mobile device at the time.

 
zigflip:
No offence taken, don't worry! Your request does seem a little bizarre though, if you have such a specific time, why not just look at the chart at that time? Also the line alert I pointed to has an alert at next bar function, meaning you could set it on an hour chart but i'm not sure if that takes the price cross at 12:00 or any cross during the preceding hour. If you mean, only crosses in the first minute of 12:00 then I say again just look at the chart on a mobile device at the time.

Good point..IMO the 1HR example will alert at any time, dont you think. True I could look at it all the time, but if I use the 4HR for example I dont want to go to my computer and check the price 6 times a day every 4 hours....there must be an easier way thats why I am asking...will play around with Mladen alert code, if you have time you could also give it a try...hope my point gets clearer now...looking only at price when a bar ends reduces the noise that happened in between...

 
Jonny473:
looking only at price when a bar ends reduces the noise that happened in between...

Nice idea! Hopefully you'll benefit from this indicator I made for you. It plays a sound file and shows pop up window (which says name of the currency pair where signal happened and number of repeated signal(s), if more than 1).

It works in one of two modes:

Mode 1: exact time.

Alert sounds at the exact desired time (format: HH:MM, many separators recognized, lots of formats are accepted: H:MM, HH, HH:M ect).

Mode 2: relative time.

In this mode alert plays every X minute of the bar. Example: set Mode_2_Minutes to 2 and alert will sound...

On H1 bar: 0:02, 1:02, 2:02, 3:02...

On H4 bar: 0:02, 4:02, 8:02...

On M5: 0:02, 0:07, 0:12, 0:17...

Can be a negative value (less than 0).

Example: if you set Mode_2_minutes to -3, alert will sound...

On H1 bar: 0:57, 1:57, 2:57...

On M15 bar: 0:12, 0:27, 0:42...

Settings:

Target_price- price above (below) which alert is played

Direction - if 1 or bigger - only play alert if price is above Target price. If -1 or smaller - only play alert if price is below Target.

Auto_reset - automatically resets alert every bar (mode 2) or every day (mode 1).

Mode- indicator mode.

Mode_1_Time- exact time for mode 1. See above.

Mode_2_Minutes- minutes for mode 2. See above.

Repeats- number of times alert is played. Max is 10.

Pause- pause in seconds between alerts. Max is 5.

Start_hour- starting hour for alerts, inclusive (0 means work during hour 0)

End_hour- ending hour for alerts, exclusive (17 means alerts are disabled after 16:59)

Start can be bigger than End. In this case alerts will play from Start hour till 23:59, from 0:00 next day till End hour.

Show_settings_on_chart- displays text (target and alert status, alert time) on chart. Text is formatted with "font size" and "color" parameters.

Alert_file- file for sound alerts.

Signal_UP- color for text when direction is "up".

Signal_DOWN- color for text when direction is "down".

Custom_digits- Target precision (text) is set with this. Negative value - auto.

font_size- size of text on chart

Note: when indicator starts playing several alerts in a row, MT4 may seem to hang. Its normal. Everything will be ok when all alerts are played (so use 1-2 alerts and 1 sec pause when you're near PC).

Best part: its completely

FREE!*

* - only if you call me awesome xD

PS: 8 hours... I must be getting rusty.

 

Wow great exactly what I was looking for....thank you works great...hope you can also use this somehow in your own trading...

Shinigami:
Nice idea! Hopefully you'll benefit from this indicator I made for you. It plays a sound file and shows pop up window (which says name of the currency pair where signal happened and number of repeated signal(s), if more than 1).

It works in one of two modes:

Mode 1: exact time.

Alert sounds at the exact desired time (format: HH:MM, many separators recognized, lots of formats are accepted: H:MM, HH, HH:M ect).

Mode 2: relative time.

In this mode alert plays every X minute of the bar. Example: set Mode_2_Minutes to 2 and alert will sound...

On H1 bar: 0:02, 1:02, 2:02, 3:02...

On H4 bar: 0:02, 4:02, 8:02...

On M5: 0:02, 0:07, 0:12, 0:17...

Can be a negative value (less than 0).

Example: if you set Mode_2_minutes to -3, alert will sound...

On H1 bar: 0:57, 1:57, 2:57...

On M15 bar: 0:12, 0:27, 0:42...

Settings:

Target_price- price above (below) which alert is played

Direction - if 1 or bigger - only play alert if price is above Target price. If -1 or smaller - only play alert if price is below Target.

Auto_reset - automatically resets alert every bar (mode 2) or every day (mode 1).

Mode- indicator mode.

Mode_1_Time- exact time for mode 1. See above.

Mode_2_Minutes- minutes for mode 2. See above.

Repeats- number of times alert is played. Max is 10.

Pause- pause in seconds between alerts. Max is 5.

Start_hour- starting hour for alerts, inclusive (0 means work during hour 0)

End_hour- ending hour for alerts, exclusive (17 means alerts are disabled after 16:59)

Start can be bigger than End. In this case alerts will play from Start hour till 23:59, from 0:00 next day till End hour.

Show_settings_on_chart- displays text (target and alert status, alert time) on chart. Text is formatted with "font size" and "color" parameters.

Alert_file- file for sound alerts.

Signal_UP- color for text when direction is "up".

Signal_DOWN- color for text when direction is "down".

Custom_digits- Target precision (text) is set with this. Negative value - auto.

font_size- size of text on chart

Note: when indicator starts playing several alerts in a row, MT4 may seem to hang. Its normal. Everything will be ok when all alerts are played (so use 1-2 alerts and 1 sec pause when you're near PC).

Best part: its completely

FREE!*

* - only if you call me awesome xD

PS: 8 hours... I must be getting rusty.
 

What would the "unlag this indicator" exactly mean?

Ochismail:
Hi guys, what should i do to unlag this indicator or if somebody can pls unlag this indicator.I have attached it.Thanks
 

I don't trade manually at the moment, my EAs are doing a great job for me. On a few demo accounts, more on that later. Keep an eye on forum

Updated indicator to version 2: now it has several mode 1 alerts. All put in the same parameter. Had to change formatting to make it work. Accepted formats:

H:MM and HH:MM

Up to 20 alerts are supported. To use several alerts, write this way:

HH:MM | HH:MM | HH:MM | HH:MM ect. Alerts are separated by "|" symbol. It can be changed in settings.

Spaces: ignored. Feel free to put as many as you like, for your own convenience.

Note that all alerts are sorted in ascending order and text notification shows info on the next alert time (spent most of my time making this part lol).

Email function has been added. Email subject and email text can be both set up. Text has some extra text: : reached target: dir:

Reminder: its a build-in email client, you will need to set it up first in MT4 settings menu. Note that mail can take a little time to be delivered sometimes.

Didn't test much, so please let me know if there is anything about it that doesn't work as it should, I'll take a look at fix if possible.

Hope it helps!

 

superb shinigami! or just get a good digital watch? One with multi-alarms and repeat countdowns? or as well as!

Reason: