How to code? - page 218

 
Bongo:
Just ask David Copperfield, he is expert on magic numbers. https://en.wikipedia.org/wiki/David_Copperfield)

I like David Blaine myself

 
quest:
Hello,

I have a problem on my EA that I have noted in the case of achieving Profit target and stop loss. How to modify code that notice was displayed only for a time?

For example: every 10 seconds

I tried using function : Sleep (), unfortunately without success.

Thank you for your help

Any help with this one please?

 
quest:
Any help with this one please?

In metatrader 4 if you wish to use some function that will display something exactly at every 10 seconds then you need to use this code:

while(true)

{

Comment("SOMETHING");

Sleep(1000*10);

}

BUT THIS HAS TO BE PUT IN SCRIPT FILE, not indicator or expert. Indicators or experts are working in tick mode - so they are refreshed when new tick comes - not exactly at 10 seconds. This will be updated in metatrader 5.

 
Kalenzo:
In metatrader 4 if you wish to use some function that will display something exactly at every 10 seconds then you need to use this code:

while(true)

{

Comment("SOMETHING");

Sleep(1000*10);

}

BUT THIS HAS TO BE PUT IN SCRIPT FILE, not indicator or expert. Indicators or experts are working in tick mode - so they are refreshed when new tick comes - not exactly at 10 seconds. This will be updated in metatrader 5.

Thanks,

The code used to the condition to be met, which is that the price is below a certain allowed percentage, activated the Alert function and PlaySound only once? ...Please help me

 

OrderSend() Question

What I want to do is send a pending order. Now, I assume that the CMD parameter would be OP_BUYLIMIT or OP_SELLLIMIT, correct? But what I'm trying to figure out is how to send the expiration.

How would I get, for example, 11/24/2009 8:10 into datetime format to put into the OrderSend() command?

Thanks.

 
nondisclosure007:
What I want to do is send a pending order. Now, I assume that the CMD parameter would be OP_BUYLIMIT or OP_SELLLIMIT, correct? But what I'm trying to figure out is how to send the expiration.

How would I get, for example, 11/24/2009 8:10 into datetime format to put into the OrderSend() command?

Thanks.

You could do something like...

int iExpire = TimeCurrent()+(MINS_TO_EXPIRE*60)

Where MINS_TO_EXPIRE is an external setting. TimeCurrent() returns the current time in seconds so you have to add the number of minutes in seconds.

Hope that helps.

Lux

 

Indicator with Expiredate

How can I make the indicator can be used only for some time. It would then display a message, see below.

 
quest:
How can I make the indicator can be used only for some time. It would then display a message, see below.

Hello!

First in global section call this dll:

#import "user32.dll"

int MessageBoxA(int hWnd,string lpText,string lpCaption,int uType);

then in start function or init function process the result from the messagebox:

int result = MessageBoxA(NULL,"Helo world!","MQL4 Messagebox",0);

Depends of the result (result int) allow or restrict access to your program.

 

Post Deleted.

 

I could see that as a possiblity, then I would have to convert that into a date time for the order.

I think I just figured this out.

string var=StringConcantinate("2009",".","12",".","30"," ","14:02");

datetime variable=StrTotime(var);[/CODE]

For 12/30/2009 at 14:02.

luxinterior:
You could do something like...

[code]

int iExpire = TimeCurrent()+(MINS_TO_EXPIRE*60)

Where MINS_TO_EXPIRE is an external setting. TimeCurrent() returns the current time in seconds so you have to add the number of minutes in seconds.

Hope that helps.

Lux
Reason: