|
|
 |

11-04-2009, 01:40 AM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 6
|
|
|
OCOCloseTrade
whats the best way to cancel an oco order?
I can open a market order in the opposite direction and that seems to work, but the oco stop order and oco limit order are still sitting in my oco Orders table.
Is there a way to close those "pending" orders, or is there a better way to cancel an oco group? I tried closetrade and fixtrade but they give me an error message about being disabled.
|

11-04-2009, 12:44 PM
|
|
Member
|
|
Join Date: Apr 2009
Posts: 53
|
|
Quote:
Originally Posted by Zeller
whats the best way to cancel an oco order?
I can open a market order in the opposite direction and that seems to work, but the oco stop order and oco limit order are still sitting in my oco Orders table.
Is there a way to close those "pending" orders, or is there a better way to cancel an oco group? I tried closetrade and fixtrade but they give me an error message about being disabled.
|
Hello Zeller,
OCO is not really an order, OCO is a group. Which deletes only if one of the entry orders inside of it executes.
If you closing a position buy opening opposite transaction for same amount, Entry Orders in OCO group will stay there unless deleted.
So to delete OCO group you have to delete the Entry Orders which belong to that specific OCO group and OCO group will be deleted automatically.
Hope it helps,
Cheers
|

11-04-2009, 06:09 PM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 6
|
|
|
I can use deleteorder and delete both entry orders like you said, but the trade is still left open. How do I get the open trade to automatically close?
|

11-04-2009, 06:29 PM
|
|
Member
|
|
Join Date: Apr 2009
Posts: 53
|
|
Quote:
Originally Posted by Zeller
I can use deleteorder and delete both entry orders like you said, but the trade is still left open. How do I get the open trade to automatically close?
|
OpenTrade() does not close anything automatically, (unless your application specifically programmed to do it in certain conditions.) Only opposite transaction for same amount can close it. (If on U.S. based account, which does not have .CloseTrade() available, if your account is from FXCM and not from FXCM UK for example.)
Your first question was regarding how to get rid of entry orders which got left after you closed your position with counter open for same amount. So that can only be done by removing orders by deleting them.
If you want your open position to close automatically, you need to create entry order at certain price at which u want to close it.
I hope i understood your question? If not please elaborate on it, and i'll be more than happy to help you to the best of my ability.
Cheers
|

11-12-2009, 04:29 PM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 2
|
|
|
CloseTrade
Hi,
Can someone please clear up for me exactly whether TradeDeskAut->CloseTrade() works or is it account dependant? As I am having issues with it.
Also, how would I specify which trade to close using the API.
.e.g. say I have two long positions on EUR/USD both same amount, using only TradeDeskAut-> OpenTrade() to close there is no way I can specify which actual trade I want to close.
Therefore, from the API docs I only see TradeDeskAut->CloseTrade available but I get exceptions when trying to send this command to the server.
Can someone please advise how I can achieve the above? Will TradeDeskAut->DeleteTradeStopLimit do what I want above?
Thanks in advance,
Jazzed
|

11-12-2009, 07:37 PM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 6
|
|
|
They're saying you have to open a trade in the opposite direction if you want to close an open trade. And that order would be applied to oldest trades first. I think that complies with the new oco rules.
If you close via an entry order I don't think you're gonna be given a guaranteed fill. If you think about how volatile the market can be, it makes sense. I'm doing it with a market order and so far it always executes. It just doesn't always give me the exact price I want. The trade off appears to be 'close my trade now' vs. 'close my trade at this price'. There are exposures for both parties either way. I could be wrong, but I'm not expecting much better than that.
Last edited by Zeller; 11-12-2009 at 08:02 PM..
|

11-13-2009, 10:20 AM
|
|
Member
|
|
Join Date: Apr 2009
Posts: 53
|
|
jazzed,
Zeller is right, U.S. Based accounts cannot manually close trades. You can only close the "buy" trade by doing a "sell" trade. This is something that dear friends at NFA cooked up and there is no way around it, unless you go with FXCM UK, which still has all the functionality like it was before.
To check what your account CAN or CANT do you can use a Permissions Checker.
Here is the code in C-Sharp, if you want i can send you the VB or VBScript versions too.
Code:
using System;
using System.Collections.Generic;
using System.Text;
class PermissionsChecker
{
static FXCore.CoreAut fxCore;
static FXCore.TradeDeskAut tradeDesk;
static string username;
static string password;
static string connection = "demo";
static string url = "www.fxcorporate.com";
static FXCore.PermissionCheckerAut ps;
public static void Main( string[] args )
{
if (args.Length < 2)
{
Console.WriteLine("Not Enough Parameters!");
Console.WriteLine("USAGE: [application].exe [username] [password]");
return;
}
username = args[0];
password = args[1];
Console.WriteLine( "Creating O2Go objects...." );
fxCore = new FXCore.CoreAut();
tradeDesk = (FXCore.TradeDeskAut)fxCore.CreateTradeDesk("trader");
Console.WriteLine( "Logging user {0} in....", username );
tradeDesk.Login( username, password, url, connection );
ps = (FXCore.PermissionCheckerAut)tradeDesk.PermissionChecker;
Console.WriteLine( "--------------- PERMISSIONS FOR USER: {0} ---------------", username );
Console.WriteLine( "Can accept quote: {0}", checkPermissions( ps.CanAcceptQuote("") ) );
Console.WriteLine( "Can change entry orders: {0}", checkPermissions( ps.CanChangeEntryOrder("") ) );
Console.WriteLine( "Can change market close order: {0}", checkPermissions( ps.CanChangeMarketCloseOrder("") ) );
Console.WriteLine( "Can change market open orders: {0}", checkPermissions( ps.CanChangeMarketOpenOrder("") ) );
Console.WriteLine( "Can change offer subscription: {0}", checkPermissions( ps.CanChangeOfferSubscription("") ) );
Console.WriteLine( "Can change stop/limit orders: {0}", checkPermissions( ps.CanChangeStopLimitOrder("") ) );
Console.WriteLine( "Can create entry orders: {0}", checkPermissions( ps.CanCreateEntryOrder("") ) );
Console.WriteLine( "Can create market close orders: {0}", checkPermissions( ps.CanCreateMarketCloseOrder("") ) );
Console.WriteLine( "Can create market open orders: {0}", checkPermissions( ps.CanCreateMarketOpenOrder("") ) );
Console.WriteLine( "Can create OCO orders: {0}", checkPermissions( ps.CanCreateOCO("") ) );
Console.WriteLine( "Can create stop/limit orders: {0}", checkPermissions( ps.CanCreateStopLimitOrder("") ) );
Console.WriteLine( "Can delete entry orders: {0}", checkPermissions( ps.CanDeleteEntryOrder("") ) );
Console.WriteLine( "Can delete market close orders: {0}", checkPermissions( ps.CanDeleteMarketCloseOrder("") ) );
Console.WriteLine( "Can delete market open orders: {0}", checkPermissions( ps.CanDeleteMarketOpenOrder("") ) );
Console.WriteLine( "Can delete quote: {0}", checkPermissions( ps.CanDeleteQuote("") ) );
Console.WriteLine( "Can delete stop/limit orders: {0}", checkPermissions( ps.CanDeleteStopLimitOrder("") ) );
Console.WriteLine( "Can exclude orders from existing OCO order: {0}", checkPermissions( ps.CanExcludeOCO("") ) );
Console.WriteLine( "Can join orders into an OCO order: {0}", checkPermissions( ps.CanJoinOCO("") ) );
Console.WriteLine( "Can request quote: {0}", checkPermissions( ps.CanRequestQuote("") ) );
Console.WriteLine( "-----------------------------------------------------------" );
Console.WriteLine( "Logging out...." );
tradeDesk.Logout();
Console.WriteLine( "Logged out." );
}
public static string checkPermissions( int permission )
{
if( permission == ps.PERMISSION_ENABLED )
{
return "Allowed";
}
else if( permission == ps.PERMISSION_DISABLED )
{
return "Not Allowed";
}
else if( permission == ps.PERMISSION_HIDDEN )
{
return "Not available";
}
else
{
return "ERROR: Unknown Permissions Code";
}
}
}
|

11-13-2009, 04:40 PM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 2
|
|
|
CloseTrade
Hi fexxxer & Zeller,
Thank you both I will try fexxxer's program in C++. Also, I will digest Zeller's reply and try to implement that suggestion.
The interesting thing is I have a UK account and I get permission issues running CloseTrade(). So I am a bit confused there.
Thanks,
Jazzed
|

11-16-2009, 11:09 AM
|
|
Member
|
|
Join Date: Oct 2008
Posts: 474
|
|
|
May I ask a question? What is a reason why you use OCO to close the trade on UK account, on which the regular stops and limits remain available?
A pair of buy/sell entry orders joined to OCO is very useful for closing the trade by the market condition on US accounts, on which stops and limits are prohibited due to NFA rule 2-43(b) (so called FIFO rule). For non-FIFO accounts OCO is rather useful to create a simple logic, for example entry on only one instrument. E.g. you want to play on USD, but not sure which EUR/USD or GBP/USD pair will move the first. So, you can create a pair of entry orders (and even 3, 4 and more orders on different instruments) and let OCO cancel other when the first is executed.
|
 |
| Thread Tools |
|
|
| 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
HTML code is Off
|
|
|
|