Expiration - page 2

 

Hi newdigital:

I understanf now that ex4 protects file so can't be undone. Thanks

Sorry for all the basic questions.

Cheers

 

Need simple money management code for EA

Could someone post code for a simple MM feature for an EA along with some instructions on where to place it?

Thanks in advance!

 

How to code an EA to show max margin level?

Hello:

Can someone tell me how to add the code so an EA will show max margin level % inccurred?

Thanks

 

How do you put an expiry date on an EA? So that after a month or whatever set time it wont work anymore?

Thank you

 
 

Expiration of order placed by script

How exactly does the expiration portion of a scripted buy work? I want to delete a pending order on Friday ( DayOfWeek()==5 ) at 1:50 pm (local time...this is 10 minutes before the markets close on Friday).

 

Just add the expiry date to the OrderSend function from your script.

Lux

 

How

Yes, but how is the expiration formated and can you specify a time or only a date? If I set the expiration for that day (date only) will it automatically delete when the market closes?

 
bkr1969:
Yes, but how is the expiration formated and can you specify a time or only a date? If I set the expiration for that day (date only) will it automatically delete when the market closes?

You can find all the answers to your questions and more in the MetaEditor help system.

Lux

 
bkr1969:
How exactly does the expiration portion of a scripted buy work? I want to delete a pending order on Friday ( DayOfWeek()==5 ) at 1:50 pm (local time...this is 10 minutes before the markets close on Friday).

The input for the expiration is in a DateTime Variable which must contain the number of seconds elapsed from 00:00 January 1, 1970 to the time you want to delete your pending order based on broker time not your time or GMT time.

the easiest way is to write the time as the examples below;

ExirationTime = StrToTime("2003.8.12 17:35"); This will return the number of seconds needed for the exact date and time your want to stop the pending order.

ExirationTime = StrToTime("17:35"); This will returns the number of second for the current date with the given time for expirations that is the date the order was placed broker time.

ExirationTime = StrToTime("2003.8.12"); This will return the number of seconds as of the date given with the time at midnight "00:00" of the given date.

remember to use your brokers time not yours. The periods and colen are required along with a space between the date and time portions and the string must be enclosed in double quotes. If you input a time or date that has already past it will generate an error. Some brokers donot accept expiaration times for pending orders you should check with your broker.

Keit

Reason: