PDA

View Full Version : Pending Order Expiration...



إبتسام شعلة
12-10-2007 17:11, 05:11 PM
Hi,

The following script will place a buystop using the previous bar high as entry, the previous bar low as stop and the previous pivot high as take profit.


https://www.forexdrop.com/attachments/15944006151238554329.mq4

Now i would like to add an expiration to the pending order. The expiration would correspond to the timeframe in which the script was run.

For example I run the script on a five minute chart. The time I run the script is 2007.12.10 01:22:34. So I would like the script to set the pending order expiration to 2007.12.10 01:25:00. Which would be the next five minute bar, since I am using it on a five minute chart.

For example I run the script on a one hour chart. The time I run the script is 2007.12.10 01:22:34. So I would like the script to set the pending order expiration to 2007.12.10 02:00:00. Which would be the next hour bar, since I am using it on an hourly chart.

For example I run the script on a four hour chart. The time I run the script is 2007.12.10 01:22:34. So I would like the script to set the pending order expiration to 2007.12.10 03:00:00 (which would correspond to my brokers four hour period regimine). Which would be the next four hour bar, since I am using it on an four hour chart.

For example I run the script on a daily chart. The time I run the script is 2007.12.10 01:22:34. So I would like the script to set the pending order expiration to 2007.12.11 00:00:00. Which would be the next daily bar, since I am using it on an daily chart.

The script would be applied to a daily chart primarily, so that would be my priority (setting expiration to the next daily bar). But I would think that when one timeframe is solved the rest will fall into place.

I've been at it for a day or so, trying to figure it out. I've checked code for 'time to next bar' indiors. I've tried multiple methods of swithing to datetime to string dataypes and vice versa. If anyone has a suggestion I am all ears.

Regards,