• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 11:46pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 11:46pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

MT4 Order Pending Order/Order Modify Issue 1 reply

Pending Order Expiration 0 replies

If it works, it works... 3 replies

Pending Order Expiration... 3 replies

set pending expiration time 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

How does expiration on pending order works?

  • Post #1
  • Quote
  • First Post: Sep 1, 2011 9:43am Sep 1, 2011 9:43am
  •  Georgebaker
  • | Joined Nov 2009 | Status: Member | 467 Posts
I have found this line of code but it is not creating a buy limit order if i use this code

Here's a code snipit to set expiration time to 10 min:

PHP Code:
int et = TimeCurrent()+(PERIOD_M5*60)*2;
 
OrderSend(Symbol(),OP_BUYSTOP,0.10, 0,3,0,0,"0",0,et,Green); 
I need to set the expiration time to 3 min. How should the code look like if i want to that?

Tried this but doesn't work eather

PHP Code:
int expiration = TimeCurrent()+(PERIOD_M1*60)*3; 
It's not placing the limit order
Blindly following others will make you blind!
  • Post #2
  • Quote
  • Sep 1, 2011 10:10am Sep 1, 2011 10:10am
  •  RaptorUK
  • Joined Jan 2008 | Status: Member | 870 Posts
Are you checking your returned error ? maybe your Broker doesn't allow you to set an expiration time or the time you are trying to set is too short ?

You must check the errors you get back when trying to place an order . . .
20 pips a day isn't too much to ask . . .
  • Post #3
  • Quote
  • Sep 1, 2011 10:30am Sep 1, 2011 10:30am
  •  Georgebaker
  • | Joined Nov 2009 | Status: Member | 467 Posts
ehh no i don't think so.

How can i show that code? Is it something like

return();

and then use the "comment" code to show it on the screen?

My ordersend looks like this : int ticket = OrderSend(Symbol(),OP_BUYLIMIT,1.0,Bid-100*point,0,0,0,"My Expert",16384,expiration,Blue);
Blindly following others will make you blind!
  • Post #4
  • Quote
  • Sep 1, 2011 11:09am Sep 1, 2011 11:09am
  •  RaptorUK
  • Joined Jan 2008 | Status: Member | 870 Posts
Quoting Georgebaker
Disliked
My ordersend looks like this : int ticket = OrderSend(Symbol(),OP_BUYLIMIT,1.0,Bid-100*point,0,0,0,"My Expert",16384,expiration,Blue);
Ignored
OrderSend returns either the ticket number or -1 if the send failed . . so

if (OrderSend(Symbol(),OP_BUYLIMIT,1.0,Bid-100*point,0,0,0,"My Expert",16384,expiration,Blue) < 0) Comment("OrderSend failed: error ", GetLastError());
20 pips a day isn't too much to ask . . .
  • Post #5
  • Quote
  • Sep 1, 2011 11:29am Sep 1, 2011 11:29am
  •  Georgebaker
  • | Joined Nov 2009 | Status: Member | 467 Posts
Ok it says:

OrderSend failed error: 3
Blindly following others will make you blind!
  • Post #6
  • Quote
  • Sep 1, 2011 11:35am Sep 1, 2011 11:35am
  •  Georgebaker
  • | Joined Nov 2009 | Status: Member | 467 Posts
I'm using FXDD, do you know what code 3 means or do i have to ask the broker?
Blindly following others will make you blind!
  • Post #7
  • Quote
  • Sep 1, 2011 11:38am Sep 1, 2011 11:38am
  •  RaptorUK
  • Joined Jan 2008 | Status: Member | 870 Posts
Quoting Georgebaker
Disliked
Ok it says:

OrderSend failed error: 3
Ignored
ERR_INVALID_TRADE_PARAMETERS 3 Invalid trade parameters.

Try a longer period, maybe 24hrs
20 pips a day isn't too much to ask . . .
  • Post #8
  • Quote
  • Sep 1, 2011 11:39am Sep 1, 2011 11:39am
  •  RaptorUK
  • Joined Jan 2008 | Status: Member | 870 Posts
Quoting Georgebaker
Disliked
I'm using FXDD, do you know what code 3 means or do i have to ask the broker?
Ignored
If you look in the Toolbox of MetaEditor under help you can find all the MQL4 syntax and error messages there . .


MQL4 Reference - Standard constants - Error codes
20 pips a day isn't too much to ask . . .
  • Post #9
  • Quote
  • Sep 1, 2011 11:46am Sep 1, 2011 11:46am
  •  Georgebaker
  • | Joined Nov 2009 | Status: Member | 467 Posts
Ok thanks for the information!
Blindly following others will make you blind!
  • Post #10
  • Quote
  • Last Post: Sep 1, 2011 12:02pm Sep 1, 2011 12:02pm
  •  Georgebaker
  • | Joined Nov 2009 | Status: Member | 467 Posts
Quoting RaptorUK
Disliked
ERR_INVALID_TRADE_PARAMETERS 3 Invalid trade parameters.

Try a longer period, maybe 24hrs
Ignored
I did a few test and it work with 15min, but not with 5min so there we have the answer. The broker doesn't allow expiration time below 5 min.

Problem solved!

Thanks for your help RaptorUK.
Blindly following others will make you blind!
  • Platform Tech
  • /
  • How does expiration on pending order works?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021