Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple limit orders - only working on current bar

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

    Multiple limit orders - only working on current bar

    Hi,

    I've noted an issue or misunderstanding how limit orders should work.

    I'm trying to send multiple limit orders to market on a certain condition, example below:


    else if (State == State.Configure)
    {
    SetProfitTarget("", CalculationMode.Percent, 0,01);
    SetStopLoss("", CalculationMode.Percent, 0,01, false);
    }


    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 1)
    return;
    }

    if (Close[0] > Close[1]))

    {
    EnterLong(Convert.ToInt32(DefaultQuantity), @"LongEntry");
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Close[0] + (-10 * (TickSize * 10))) , @"LongLimit1");
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Close[0] + (-20 * (TickSize * 10))) , @"LongLimit2");
    }


    What will happen in backtester, is that the limit orders only get filled on current bar and seems to get removed after current bar is complete. Should it work like this? If yes, is it very complicated to get the limit orders staying active after bar complete? Or do I need to change the way the stop and profit is handled for this to work?

    br,
    Chris

    #2
    Hello,

    Thank you for the post.

    Yes, this could be expected, if the price movement allows for a fill within the bar and it could fill, it will. Otherwise, if the order is just expiring this would be expected for any order that can persist for more than one bar with the Managed approach. You would either need to have the logic that calls the EnterLongLimit syntax remain true for a number of bars the limit should be active or use IsLiveUntilCancelled syntax:
    http://ninjatrader.com/support/helpG...enterlonglimit

    Code:
    EnterLongLimit(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double limitPrice, string signalName)
    Setting this to true will allow the orders to persist longer than 1 bar.

    You can see when orders are expired using TraceOrders:
    http://ninjatrader.com/support/helpG...ub=traceorders

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

    Comment


      #3
      Hi again,

      Found this through another thread, not directly related to my issue but still; do I need to go here for getting my "idea" to work:
      http://ninjatrader.com/support/helpG...r_handling.htm

      br,
      Chris

      Comment


        #4
        Thank You!

        I understand this sets another level of risk but I will investigate, if this is where I'm comfortable going at this point.

        br,
        Chris

        EDIT: you can mark thread as solved.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mballagan, Today, 01:02 PM
        0 responses
        2 views
        0 likes
        Last Post mballagan  
        Started by larkmail, Today, 12:30 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by omermirza, Today, 12:39 PM
        0 responses
        9 views
        0 likes
        Last Post omermirza  
        Started by Danila, Today, 11:08 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by dbida001, Today, 10:31 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X