Symbol value update!

 
Dear All,

This is Wizard and I am a newbie in the MQL4, Actually, It looks like that it is easy to learn, but I am a little bit confused with MQL4 logic..........I do not know .....

Anyways, I just wanted to ask a simple question, I want to create a simple program that checks whether the specified symbol updated or not in the market watch for a specific period of seconds.........
Let me clear this program: Show a message box if the USDHKD symbol was not updated for more than 7 seconds in the market watch...... Is that possible with MQL4 and which better to use: Script or EA....


Your help will be greatly appreciated,
thanks in advance.

Wizard__

 

Hi

Market watch window shows every tick therefore all you want is an alert on every tick that times out after no ticks are received for a set time. Why would you want that? what possible use is it? Could you enlighten me?

 
Thanks for your quick reply.
Actually, I just wanted to create this program, There is no reason for it, just check the possibility for this....

Can you be a little bit more clear, I have created an EA for this program, And checking BID/ASK differences for each incoming tick, but the bad news is that for USDHKD sometimes the tick is coming every 50 seconds, so that i dont have a full control for this..... I mean i cant popup a message box if the symbol was not updated for 7 seconds.....I have to wait till the new coming tick, and maybe the incoming tick may take more than the specified time I want (7 Seconds).....!


Your help will be greatly appreciated

Thanks in advance


Wizard__

 

Hi

Use a continuous loop so on the first tick the EA is entered then it never leaves. There is an article about it on this site somewhere written to get around the problem of real time requirements of algorithms.

 
Ruptor:

Hi

Use a continuous loop so on the first tick the EA is entered then it never leaves. There is an article about it on this site somewhere written to get around the problem of real time requirements of algorithms.

Thanks for your suggestions,

Do you remember that article name :-) any headlines, keywords.............

And one more question, if I will use a continuous loop in the EA, does this eat the CPU usage to 100% !!



Thanks in advance


Wizard__

 

Hi

I can't find the article maybe one of the experts can point us to it. The essence of the EA is that in the start function you make a continuous loop with no return. In your case you would read the Bid price wait 100mS then read it again and say send an alert after 7 seconds of no change in price. After the Alert it would continue around the loop and look for the next 7 second interval with. The only way to stop the code is to remove it from the chart.

 

Hi

You need to use the sleep command so it don't tie up cpu. I have never done this before but I think this would work better. This has a reslolution of 1 second. You can set the sleep command to 500 mS but the faster the EA goes around the loop the more CPU time it will occupy. You may need to check the logic for the count reset because I didn't give it much thought. Just trying to point you in the right direction.




 
Ruptor:

Hi

I can't find the article maybe one of the experts can point us to it. The essence of the EA is that in the start function you make a continuous loop with no return. In your case you would read the Bid price wait 100mS then read it again and say send an alert after 7 seconds of no change in price. After the Alert it would continue around the loop and look for the next 7 second interval with. The only way to stop the code is to remove it from the chart.

Is this the one you were referring to?

https://www.mql5.com/en/articles/1558


CB

 

Hi CB

In short no. I don't think it was this article either

https://www.mql5.com/en/articles/1399

But it gives some more information about continuous loop operation.

Thanks

 
Ruptor:

Hi

You need to use the sleep command so it don't tie up cpu. I have never done this before but I think this would work better. This has a reslolution of 1 second. You can set the sleep command to 500 mS but the faster the EA goes around the loop the more CPU time it will occupy. You may need to check the logic for the count reset because I didn't give it much thought. Just trying to point you in the right direction.




Thank you so much, Your help is really appreciated :-)

Reason: