Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Stop order quantity didnt increase as partial fills got executed

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

    Stop order quantity didnt increase as partial fills got executed

    i have the below code in my strategy,

    today i got a submitted an order for 351 lots
    i got partial fills for 15 50 and 286
    for some reason the size of the stop order only went up to 65 lots rather than 351.
    the stop order size didnt update for the final fill

    Can you see any issues in code below that would have caused this to occur



    protected override void OnExecution(IExecution execution)
    {
    if (entryOrder != null && entryOrder == execution.Order)
    {
    if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
    {
    if (LongOrder == true)
    {
    // Long Stop-Loss
    stopOrder = ExitLongStopLimit(0, true, execution.Order.Filled,StopLine - SlipAmount * TickSize,StopLine , "StopLine", "");

    // Long Target
    targetOrder = ExitLongLimit(0, true, execution.Order.Filled, TargetLine, "Target", "");
    }
    else
    {
    //Short Stop-Loss
    stopOrder = ExitShortStopLimit(0, true, execution.Order.Filled,StopLine + SlipAmount * TickSize,StopLine , "StopLine", "");

    // Short Target
    targetOrder = ExitShortLimit(0, true, execution.Order.Filled, TargetLine, "Target", "");
    }

    #2
    Hello,

    Thank you for the question.

    I currently do not see what may be happening by what is posted, have you at this point used Prints in the OnExecution to see when the stop order is being set what values are being passed and how frequently it gets set?

    That would be a good starting point, outside of that you may try TraceOrders to see if you are running into any problems with the orders : http://ninjatrader.com/support/helpG...ub=traceorders

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by frankthearm, Today, 09:08 AM
    7 responses
    27 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by NRITV, Today, 01:15 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by maybeimnotrader, Yesterday, 05:46 PM
    5 responses
    24 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by quantismo, Yesterday, 05:13 PM
    2 responses
    16 views
    0 likes
    Last Post quantismo  
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X