Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"Order rejected: Broker or exchange option"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    "Order rejected: Broker or exchange option"

    I was running a live automated strategy at 3:06 AM central time, which fired off a Short Limit Entry order for 2 contracts with profit and stop targets using the code below. This normally works, but caused an error this morning.

    contractQuantity = 2;
    entryPriceShortRedCount = 12867;

    protectedoverridevoid OnBarUpdate()
    {
    ShortRedCtEntryOrder = EnterShortLimit(contractQuantity, entryPriceShortRedCount, "Short Red Count : 0");
    }

    protectedoverridevoid OnExecution(IExecution execution)
    {
    if (ShortRedCtEntryOrder != null && ShortRedCtEntryOrder.Token == execution.Order.Token)
    {

    if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
    {
    ShortRedCtTargetOrder = ExitShortLimit(
    0, true, execution.Order.Filled, execution.Price - 40 * TickSize, "Profit Target", "Short Red Count : 0");
    ShortRedCtStopOrder = ExitShortStop(
    0, true, execution.Order.Filled, execution.Price + 75 * TickSize, "Stop Loss", "Short Red Count : 0");
    ShortRedCtEntryPrice = execution.Price;

    }
    // Resets ShortRedCtEntryOrder object to null after order has been fully filled
    // or partially filled with the remaining orders cancelled
    if (execution.Order.OrderState != OrderState.PartFilled // fully filled/cancelled
    )
    {
    ShortRedCtEntryOrder =
    null;
    }
    }
    }

    The Entry order was partially filled with 1 contract, then fully filled with the second contract.
    The Profit target order was submitted for 1 contract, then the Stop target was accepted for 2 contracts. It looks like the Profit Target then was modified to have 2 contracts as needed, but the broker rejected that modification.

    Not sure what happened exactly, but the log file is attached. Can you please help me understand the sequence of events that lead to my strategy being shut down and the trade being exited instantly. I lost a large sum of $ because this crashed and missed not only this profit, but the subsequent trade, which never fired because the strategy had crashed.
    Attached Files

    #2
    Hello,

    Thank you for your post and for reporting.

    This would be a native error from the broker or the exchange servers. In order to determine what occurred, we will need more information than you provided in your log.

    Can you please email us your complete log and trace files. You can do this by going to Help--> Mail to Support and checking "log and trace"

    Please also include "Attn: Matthew" and a reference to this thread url.

    Thanks
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by trader3000a, Today, 03:30 PM
    0 responses
    1 view
    0 likes
    Last Post trader3000a  
    Started by trader3000a, Today, 02:22 PM
    0 responses
    2 views
    0 likes
    Last Post trader3000a  
    Started by kaywai, Today, 12:05 PM
    0 responses
    54 views
    0 likes
    Last Post kaywai
    by kaywai
     
    Started by DTSSTS, 01-14-2022, 02:53 PM
    3 responses
    25 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by SuperDude123, Today, 05:17 AM
    2 responses
    19 views
    0 likes
    Last Post SuperDude123  
    Working...
    X