Trade FOREX with FXCM

  • Award-Winning Platform
  • 24/7 Customer Support
  • Trade Directly on Charts
  • Free $50K Practice Account
Register


Results 1 to 5 of 5

Thread: OderStatus 'S'

  1. #1
    Alessan is offline Member
    Join Date
    May 2012
    Posts
    9

    OderStatus 'S'

    Hi,

    Anytime I cancel an order, I get a order status 'S'. This is not documented at Index

    public method IO2GOrderRow.getStatus
    The state of the order. See possible values in details.
    Declaration
    C++
    virtual const char * getStatus () = 0

    Details

    Possible values:
    W
    Waiting.

    P
    In process.

    I
    Dealer intervention.

    Q
    Requoted.

    U
    Pending calculated.

    E
    Executing.

    C
    Cancelled.

    R
    Rejected.

    T
    Expired.

    F
    Executed.

    G
    Not Available.

  2. #2
    Alessan is offline Member
    Join Date
    May 2012
    Posts
    9
    Ok,reading Open Market and Close Market Orders,appears as Pending Cancelled (S)

    One question more, There is any way to get the status of an order executed, cancelled, rejected while not connected?

    Similar to ClosedTrades?

    Example, I open an order and inet connection goes off, 2 hours later I reconnect and need update order status on database.

  3. #3
    Natalya is offline Member
    Join Date
    Apr 2009
    Posts
    747
    Quote Originally Posted by Alessan View Post
    Example, I open an order and inet connection goes off, 2 hours later I reconnect and need update order status on database.
    Please check the command Get Last Order Update

  4. #4
    Alessan is offline Member
    Join Date
    May 2012
    Posts
    9
    Hi,

    Thanks for response, I have another issue,

    I read the post about create a limit/stop order on an existing trade, but every time i get the error:

    Error on request: U100D3_QYTtK4y9mKpSYTSWiMPgQvnlhC7bOL085r7eItMqsSNSgc0DkWZAI3al6-5 - Desc=19915;DAS 19915: ZDas Exception
    ORA-20179: Unable to find primary order for order 143505408

    Then I make a simple test, on connect get open trades and call for this funcion for each:

    Code:
    void FXCM_O2G_Broker::SO(O2G2Ptr<IO2GTradeRow> trade)
    {
            IO2GRequestFactory *factory = m_Session->getRequestFactory();
            if (factory == NULL)
                return;
    
            IO2GValueMap *valueMap = factory->createValueMap();
            valueMap->setString(::Command, O2G2::Commands::CreateOrder);
            valueMap->setString(::OrderType, O2G2::Orders::Stop);
            valueMap->setString(::AccountID, trade->getAccountID());
            valueMap->setString(::OfferID, trade->getOfferID());
            valueMap->setString(::TradeID, trade->getTradeID());
            if(trade->getBuySell()[0] == 'S')
            {
                valueMap->setString(::BuySell, O2G2::Buy);
                valueMap->setDouble(::Rate, 2.0);
            }
            if(trade->getBuySell()[0] == 'B')
            {
                valueMap->setString(::BuySell, O2G2::Sell);
                valueMap->setDouble(::Rate, 1.0);
            }
            valueMap->setInt(::Amount, trade->getAmount());
           IO2GRequest *request = factory->createOrderRequest(valueMap);
           if(request)
           {
                m_ResponseQueue.addToQueue(request->getRequestID());
                m_Session->sendRequest(request);       
                IO2GResponse* res = m_ResponseQueue.waitForResponse(request->getRequestID(), 10000);
                m_ResponseQueue.removeFromQueue(request->getRequestID());
           }
    }
    the funcion called On Connect is:
    Code:
    bool FXCM_O2G_Broker::SyncTrades()
    {
        try
        {
            IO2GRequestFactory *requestFactory = m_Session->getRequestFactory();
            IO2GRequest *request = requestFactory->createRefreshTableRequestByAccount(Trades, m_AccountID.c_str());
            requestFactory->release(); 
            
            if(request)
            {
                std::cout << "SyncTrades for account " << m_AccountID << std::endl;            
                m_ResponseQueue.addToQueue(request->getRequestID());
                m_Session->sendRequest(request);
    
                IO2GResponse* response = m_ResponseQueue.waitForResponse(request->getRequestID(), 5000);
    
                if(!response)
                {
                    m_ResponseQueue.removeFromQueue(request->getRequestID());
                    return false;
                }
                else
                {
                    IO2GResponseReaderFactory *responseReaderFactory = m_Session->getResponseReaderFactory();
    
                    IO2GTradesTableResponseReader *responseReader = responseReaderFactory->createTradesTableReader(response);
                    responseReaderFactory->release();
    
                    std::cout << "trades table size: " << responseReader->size() << std::endl;
                    
                    std::deque<SB_Trade> sync;
                    for (int i = 0; i < responseReader->size(); ++i)
                    {
                        IO2GTradeRow *tradeRow = responseReader->getRow(i);
                        
                        this->SO(tradeRow);
                        
                        SB_Trade trade = ToSBTrade(this->getName(), tradeRow);
                        sync.push_back(trade);
                        //tradeRow->release();                
                    }
                    TradeManager::getSingleton().SyncTrades(this->getName(), sync);
                }
                m_ResponseQueue.removeFromQueue(request->getRequestID());
            }
            
            return true;
        }
        catch(std::exception &e)
        {
            std::cout << "FXCM_O2G_Broker::SyncTrades()" << e.what() << std::endl;
            return false;
        }
    }
    I get same result ,error: ORA-20179: Unable to find primary order for order xxxxxxx

    What is missing? May be my accout is FIFO?

    (You can create either regular stop and limit orders (for non-FIFO accounts) or ELS (entry stop limit) orders for FIFO accounts)
    Last edited by Alessan; 07-02-2012 at 07:27 PM.

  5. #5
    Natalya is offline Member
    Join Date
    Apr 2009
    Posts
    747
    It seem that you use FIFO account. It is not possible to add Stop/Limit (ELS) orders to existing positions on FIFO account. You can only attach Stop/Limit when creating a market order.

    If you need to handle risk management for existing trades, you can use Net Stop/Limit orders.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
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.