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 rexsole, Today, 08:39 AM
    0 responses
    4 views
    0 likes
    Last Post rexsole
    by rexsole
     
    Started by trilliantrader, Yesterday, 03:01 PM
    3 responses
    30 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    4 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Brevo, Today, 01:45 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    74 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Working...
    X