Go Back   DailyFX Forum > FXCM Products and Services > FXProgrammers > Discussion / Support Forum > Order2Go COM Trading API Support

Reply
 
Thread Tools Rate Thread
  #1 (permalink)  
Old 04-01-2009, 04:25 PM
parnoldson's Avatar
Member
 
Join Date: Nov 2006
Posts: 30
parnoldson is on a distinguished road
Question Stop/Limit price did not pass validation

I am getting this message when calling ChangeEntryOrderStopLimit

Error: "Stop/Limit price did not pass validation 1.3211(1.32081) vs 1.3186"

were the Current Ask: 1.324570, Current Bid: 1.324280.

I understand that my stop order is 1.3211 and I am tring to place its stop value to be 1.3186. I am not sure how to read the error message. Why am I getting this? please help.
Reply With Quote
  #2 (permalink)  
Old 04-02-2009, 12:34 PM
Moderator
 
Join Date: Jan 2006
Posts: 1,990
FXCM Help is on a distinguished road
Is this for an entry ordering waiting to be executed or an order which is already open?
Reply With Quote
  #3 (permalink)  
Old 04-02-2009, 01:32 PM
parnoldson's Avatar
Member
 
Join Date: Nov 2006
Posts: 30
parnoldson is on a distinguished road
Yes this is just an entry order. I have repeated this over and over again. I am suprised that this hasn't been brought up before now.
Reply With Quote
  #4 (permalink)  
Old 04-02-2009, 02:04 PM
Member
 
Join Date: Oct 2008
Posts: 474
Nikolay.Gekht is on a distinguished road
The stop order is always validated against the close price. The minimal required distance between the close price and the stop level is shown in the COND_DIST system property.

In order to explain your situation and check it for the correctness could you please show:
a) bid/ask price at the moment of the problem.
b) stop order level.
c) value of the COND_DIST system property
d) entry order direction (buy or sell).
Reply With Quote
  #5 (permalink)  
Old 04-02-2009, 02:42 PM
parnoldson's Avatar
Member
 
Join Date: Nov 2006
Posts: 30
parnoldson is on a distinguished road
I am not having problems with placeing the stop order itself, I understand the rules and all of the points a,b,c,d when placing the stop order. This is working fine. The problem is when I am creating a stop to the original stop order. This is where I am getting this error message. if you would like detail well then here it is:

symbol: EUR/USD
a) Ask: 1.32241 Bid: 1.32215
b) Stop order Level: 1.317
c) COND_DIST: 0
d) entry order direction: buy
//at this point placing this order works when placed...
//now add a stop to this.. ChangeEntryOrderStopLimit()
e) Stop value: 1.3145
error: "Stop/Limit price did not pass validation 1.317(1.31674) vs 1.3145"

Now after deleting this order and trying again with the exact values this will work.
I belive this has somthing to do with the spread and maybe the check on bid ask levels. I am not sure though. Hope this helps, help me.
Reply With Quote
  #6 (permalink)  
Old 04-03-2009, 01:16 PM
Member
 
Join Date: Oct 2008
Posts: 474
Nikolay.Gekht is on a distinguished road
Please, ensure that entry order is a BUY, not a SELL entry order.

If so, it looks like a bug, so could you please write me:
a) connection name and user name
b) date and time of the failed operation
c) account number
d) order id at which you can't change the stop level.

You can use nikolay(at)gekht(dot)us email to avoid writing the information in the forum (I'm not sure whether personal messages at the forum work now). I will work closely with the development team in order to fix the problem. You can also write it to support, just ask them to copy the information to me, please. They know how.

Thank you.
Reply With Quote
  #7 (permalink)  
Old 04-03-2009, 03:23 PM
parnoldson's Avatar
Member
 
Join Date: Nov 2006
Posts: 30
parnoldson is on a distinguished road
These orders are being set as BUY orders if they weren't I would get a different error when tring to place the entry order. I wouldn't ever get to the code to try and attach a stop to it. any ways here is the infor requested.

Connection: http://FXCorporate.com Demo
User Name: FXM403746001
User Password: ****
AccountID: 397493

Example one:
Current Ask: 1.34722
Current Bid: 1.34693
Entry Order Rate: BUY @ 1.34390
Time: 4/3/2009 7:13:16 PM //this is in UTC
Order ID: 44013375
Stop rate for ChangeEntryOrderStopLimit: 1.34140
Error: Stop/Limit price did not pass validation 1.3439(1.3436100000000002) vs 1.3414

Example two:
Current Ask: 1.34718
Current Bid: 1.34689
Entry Order Rate: BUY @ 1.34480
Time: 4/3/2009 7:18:07 PM //this is in UTC
Order ID: 44013511
Stop rate for ChangeEntryOrderStopLimit: 1.34230
Error: Stop/Limit price did not pass validation 1.3448(1.3445099999999999) vs 1.3423

hope this is what you want. thanks.

Last edited by Nikolay.Gekht; 04-04-2009 at 01:36 PM..
Reply With Quote
  #8 (permalink)  
Old 04-04-2009, 01:38 PM
Member
 
Join Date: Oct 2008
Posts: 474
Nikolay.Gekht is on a distinguished road
Exactly so! Thank you very much. I'll contact with developers immediately and will keep you informed about the progress.

p.s. Just be careful with your password in future, please. I replaced it in your post with **** :-)

Last edited by Nikolay.Gekht; 04-04-2009 at 01:43 PM..
Reply With Quote
  #9 (permalink)  
Old 04-06-2009, 06:16 PM
Member
 
Join Date: Oct 2006
Posts: 7
adblue is on a distinguished road
Yes, it's a bug: Using CreateEntryOrder instead of the Fix-Orders succeeds

Using Fix-Orders I often was getting the same bug. I have replaced this for the moment successfull with the old (non-FIX) CreateEntryOrder. But in this case it's not possible to use any QTXT-remarks. FXCM, please correct this, because many of us love to work with FIX-Orders and QTXT ... .
Reply With Quote
  #10 (permalink)  
Old 04-06-2009, 07:06 PM
Member
 
Join Date: Oct 2008
Posts: 474
Nikolay.Gekht is on a distinguished road
We have checked your orders. These entry limit orders have attached limit orders and never have any stop orders. Could you check, please your code, whether it creates stop order correctly.

Here is the successful working example of creation of the stop order via FIX orders for the entry-limit order with attached stop order. The example is written on C#. The example supposes that connection is successfully established.

Code:
/** Get account id and minumal position size for the entry order. */
FXCore.TableAut table = (FXCore.TableAut)mDesk.FindMainTable("accounts");
string acct = (string)table.CellValue(1, "AccountID");
int size = (int)table.CellValue(1, "BaseUnitSize");
/** Calculate rates. */
table = (FXCore.TableAut)mDesk.FindMainTable("offers");
/** Instrument (must be EUR/USD. */
string instrument = (string)table.CellValue(1, "Instrument");
/** bid and ask prices. */
double ask = (double)table.CellValue(1, "Ask");
double bid = (double)table.CellValue(1, "Bid");
/** spread. */
double spread = ask - bid;
/** buy entry limit must be below the market. */
double rate = bid - spread * 5;
/** create the entry order. */
object order = null, di = null;
mDesk.CreateFixOrder(mDesk.FIX_ENTRYLIMIT, "", rate, 0, "", acct, instrument, true, size, "", out order, out di);
string order_id = (string)order;
/** And set the stop order below the open price. */
double stoprate = rate /** entry order rate. */ - 
                  spread /* expected close rate. */ - 
                  0.0002 /** 1 pip is COND_DIST on my account plus another pip to be below the limit. */
mDesk.ChangeEntryOrderStopLimit(order_id /* entry id. */, stoprate, true /** Change STOP, not LIMIT!. */, 0 /* No trailing. */);
Reply With Quote
  #11 (permalink)  
Old 04-07-2009, 12:34 PM
parnoldson's Avatar
Member
 
Join Date: Nov 2006
Posts: 30
parnoldson is on a distinguished road
Quote:
Originally Posted by Nikolay.Gekht View Post
We have checked your orders. These entry limit orders have attached limit orders and never have any stop orders. Could you check, please your code, whether it creates stop order correctly.
This is the problem that spawned the thread. The orders that I am placing are a entry limit order that have attached limit orders and have attached stop orders. When finished the entry order takes with its limit side. The problem is that the stop order is never placed because of said error.

here is my code example of what I am doing not in c# but in c++ and assuming already connected.

Code:
//... code to get account and instrument ...

m_pTradeDesk->CreateFixOrder(m_pTradeDesk->FIX_ENTRYLIMIT, "", rate, 0, "", bAccount, bInstrument, true, nQty, "", &ordID, &psd);
//dStop is rate of the stop and dLimit is the rate of the limit
CString csOrdID(ordID.bstrVal);
if (dLimit > 0) // Order has attached limit, create it...
	CreateAttachedLimitStop(false, csOrdID, dLimit);
if (dStop > 0) //Order has attached stop, create it...
	CreateAttachedLimitStop(true, csOrdID, dStop);


bool CreateAttachedLimitStop(bool bStop, CString vTradeID, double dRate)
{
	CString sType;
	try
	{	
		VARIANT_BOOL side;
		if (bStop)
		{	//stop side of the order
			sType = "stop";
			side = VARIANT_TRUE;			
		}
		else
		{
			sType = "limit";
			side = VARIANT_FALSE;
		}
		m_pTradeDesk->ChangeEntryOrderStopLimit((LPCSTR)vTradeID,dRate,side,0);

		return true;
	}
	catch(_com_error e)
	{
//*********THIS IS THE CATCH THAT I AM HITTING!!!!!********
		// Unable to effect the requested change...
		// Inform the user what happened to make their order disappear
		CString csErr;
		BSTR bstr;
		e.ErrorInfo()->GetDescription(&bstr);
		csErr.Format("Could not add attached %s while placing FXCM "
					 "order. The FXCM error was:\n\n%s\n\nThe attached "
					 "%s has not been placed.",
					 sType, CString(bstr), sType);
		MessageBox(::AfxGetMainWnd()->GetSafeHwnd(), csErr, "Order could not be placed", MB_OK);
		return false;
	}
}
Also I have noted that I have been able to place this order propperly many times. This only happens about 1 or 2 times out of 10. "SAME CODE"
Reply With Quote
  #12 (permalink)  
Old 04-07-2009, 02:47 PM
Member
 
Join Date: Oct 2008
Posts: 474
Nikolay.Gekht is on a distinguished road
I confirm, since stop order is created immediately after the limit order - I got the same failure. Thank you for clarification of the problem. I'll keep you informed about the progress.

Last edited by Nikolay.Gekht; 04-07-2009 at 02:53 PM..
Reply With Quote
  #13 (permalink)  
Old 04-07-2009, 03:57 PM
jlanawalt's Avatar
Member
 
Join Date: Aug 2006
Posts: 112
jlanawalt is on a distinguished road
Applies to at least 1.04.021609 and 01.04.030309

I don't know how long this has been an issue. Perhaps adblue can weigh in on when they decided to switch back to CreateOrder. parnoldson is using 1.04.021609. I can confirm the bug with the most recent devel release, 01.04.030309.
__________________
Jacob Anawalt
Gecko Software, Inc.
Reply With Quote
  #14 (permalink)  
Old 04-07-2009, 06:01 PM
Member
 
Join Date: Oct 2008
Posts: 474
Nikolay.Gekht is on a distinguished road
I reproduced the bug on 03032009 release. As far as I can see this bug is in the logic which allows operating on orders immediately after creation and before the order comes back as the update of the orders table. This logic is implemented in Dec, 2008.

Unfortunately, there is not workaround except to use CreateFixOrder for stop and limit orders. But these methods require tradeid, so, you will have to wait until the entry order appears in the order table.
Reply With Quote
  #15 (permalink)  
Old 04-08-2009, 11:19 AM
parnoldson's Avatar
Member
 
Join Date: Nov 2006
Posts: 30
parnoldson is on a distinguished road
Will this be fixed in the next update, or will I need to do a work around for this and there wont be a fix?
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.

All times are GMT -5. The time now is 07:12 PM.
Copyright ©2009 Daily FX. All Rights Reserved.