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

How to CHASE a LIMIT Entry Order - MANAGED

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

    How to CHASE a LIMIT Entry Order - MANAGED

    Good Morning! I've been programming a strategy that I'd like to enter my initial LIMIT ORDER and then have the strategy CHASE the LIMIT ENTRY order until I cancel. This is what I have so far:

    if ( Position.MarketPosition == MarketPosition.Flat && entryOrder == null
    && <<< remaining conditions >>>
    {
    EnterShortLimit( 0, true, Convert.ToInt32( ContractQty ), BollingerBandSetLower100_14[0] + 2 * TickSize, "Short Market Entry WALK THE LINE" );
    entryTime = ToTime( Time[0] );
    Print( "SHORT Entry Time WALK THE LINE Time = " + entryTime );
    barNumberOfOrder = CurrentBar;
    }

    if ( entryOrder != null && CurrentBar > barNumberOfOrder + 2 )
    {
    CancelOrder( entryOrder );
    cancelTime = ToTime( Time[0] );
    Print( "Cancelled SHORT Limit Entry Order Time = " + cancelTime );
    }​


    Since, the condition is liveUntilCancelled, I'd like to update the entry limit order with BollingerBandSetLower100_14[0] + 2 * TickSize​ with each current new bar UNTIL Cancelled (and yes, there's more support code below in OnOrderUpdate)

    I cannot find or figure an easy way, at my programming level, of how to quickly administer, essentially following the BollingerBandSetLower100_14[0] + 2 * TickSize.

    Could you please help with this context of how to Chase my Limit entry orders? Thanks in advance! -John​​

    #2
    Hello 317234,

    Below is a link to an example ProfitChaseStopTrailExitOrdersExample with sample logic of a limit order chase.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Good Morning! Thank you. I've been mucking the process of putting all the parts and pieces together for the entry trail and I had already come across that example and have it downloaded already.
      Question: Do we have to first enter the INITIAL limit order and THEN change it with trailing criteria? As in, another IF-THEN looking for entryOrder != null and then chase the limit entry order? Would it be possible for you to parse the ProfitChaseStopTrailExitOrderExample and point out what details I would critically need to do this function (ie, would I need OnOrderExectution as well)? Thanks for you help NinjaTrader_ChelseaB!

      Comment


        #4
        Hello 317234,

        Yes, the limit has to be submitted before it can have the price modified for chasing action.

        In this example the limit is submitted in OnExecutionUpdate() on line 228. (You can submit the order in OnBarUpdate() if this is an entry)
        The limit order, once submitted is assigned to an Order variable in OnOrderUpdate() on line 250/97.
        The chase action condition is in OnBarUpdate() on line 190 and the order price is modified to the new chase price on line 195.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        7 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X