Login Page - Create Account

Support Board


Date/Time: Tue, 07 May 2024 21:26:09 +0000



Post From: Order for different symbol - supported for IB with Equity options?

[2019-05-20 20:09:04]
User177773 - Posts: 4
Tried adding the error message code per above link -> No error messages generated in the main log and no trades appear in trade service log

Here is a code:

if (TradingAllowed && sc.CrossOver(Subgraph1Reference, Subgraph2Reference) == CROSS_FROM_BOTTOM)
  //if (TradingAllowed)    
  {
    // mark the crossover on the chart
    Subgraph_BuyEntry[sc.Index] = sc.Low[sc.Index];

    // Create a market order and enter long.
    s_SCNewOrder NewOrder;
    NewOrder.OrderQuantity = 1;
    NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
    NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
    //NewOrder.Symbol = "SPY-OPT-20190520-285-C-SMART-100-USD";
    //NewOrder.Symbol = "SPY 190520C00285000";
    //NewOrder.Symbol = "QQQ1";
    //NewOrder.Symbol = "IWM";
    //NewOrder.Symbol = "SPY 190520C00283000-SMART-OPT-USD";
    NewOrder.Symbol = "SPY-OPT-20190520-283-C-SMART-100-USD";

    //sc.BuyEntry(NewOrder);
    //sc.BuyOrder(NewOrder);
    //int Result = sc.BuyEntry(NewOrder);
    int Result = sc.BuyOrder(NewOrder);
if (Result > 0)//order was accepted
{
//Take appropriate action if order is successful
}
else//order error
{
//Only report error if at the last bar
if (sc.Index == sc.ArraySize -1)
{
//Add error message to the Sierra Chart Message Log for interpretation
sc.AddMessageToLog(sc.GetTradingErrorTextMessage(Result), 0);
}
}

The symbol name used ("SPY-OPT-20190520-283-C-SMART-100-USD") matches the SC online manual definition:
and was used successfully as the symbol name in SC to chart option prices with data received from IB.
I also double checked in IB option chain that this particular option exists - it does, and price data matches price displayed in SC chart.

I should point out that the IB account used for this is a "papertrade" account of type DUxxxxx associated with a real IB account.

Please advise next step!

Thanks!

Erik