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

Strategy Submit One Limit Order At a Time

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

    Strategy Submit One Limit Order At a Time

    Hello,



    I am using the Managed Approach from the wizard with the following in NT8.
    EnterLongLimit() (isLiveUntilCancelled is set to true)
    EnterShortLimit()
    SetStopLoss()
    SetProfitTarget()

    Concerns
    1. If I have a pending limit order waiting to fill, I do not want to the strategy to generate another order long or short. I only want strategy to generate orders if positions is flat and no pending limit orders.

    2. If I have an open position, I do not want the strategy to generate another order, long or short.

    Questions
    1. Will setting EntriesPerDirection = 1, and EntryHandling = AllEntries resolve my concern above?

    2. Does NT8 automatically have a solution to the two concerns above or do i have code something like tracking the order and use as a criteria in my logic?


    I do not understand this part: " Enter a position will be ignored if:The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction"

    3. Per the statement above, Will the new generated order be ignored if the new order is the same direction as the order that is active?

    4. If I need to track the entry order, do I need to use something similar to the code attached from here https://ninjatrader.com/support/help...rderupdate.htm

    Thank you
    Attached Files
    Last edited by simple_goodoboy; 05-09-2017, 12:21 PM.

    #2
    Hello goodoboy,

    Thank you for your post.

    Originally posted by simple_goodoboy View Post
    Concerns
    1. If I have a pending limit order waiting to fill, I do not want to the strategy to generate another order long or short. I only want strategy to generate orders if positions is flat and no pending limit orders.
    2. If I have an open position, I do not want the strategy to generate another order, long or short.
    You would use EntriesPerDirection set to 1 and EntryHandling set to AllEntires: https://ninjatrader.com/support/help...rdirection.htm
    You would also include a check for the Position in your code: https://ninjatrader.com/support/help...etposition.htm
    For example:
    Code:
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    // your entry logic
    }
    Originally posted by simple_goodoboy View Post
    I do not understand this part: " Enter a position will be ignored if:The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction"
    This would refer to submitting an Exit order when an Entry to go in the opposite position of the Exit is present.

    Originally posted by simple_goodoboy View Post
    Per the statement above, Will the new generated order be ignored if the new order is the same direction as the order that is active?
    No, EntriesPerDirection would handle this.

    Please let me know if you have any questions.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      You would also include a check for the Position in your code: https://ninjatrader.com/support/help...etposition.htm
      For example:
      Code:
      if (Position.MarketPosition == MarketPosition.Flat)
      {
      // your entry logic
      }
      Thank you PatrickH,

      Can I set EntriesPerDirection = 1 and EntryHandling = EntryHandling.AllEntries in the strategy window settings window or/and do I need to enter the logic below in my code?


      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      EntriesPerDirection = 1;
      EntryHandling = EntryHandling.AllEntries;
      }
      }


      Also, Position.MarketPosition gets the "strategy's" current market position. Does this means that the strategy keeps track of the market position? This is not the same thing as tracking order status at the broker side right?

      Thanks,

      Comment


        #4
        Originally posted by simple_goodoboy View Post
        Can I set EntriesPerDirection = 1 and EntryHandling = EntryHandling.AllEntries in the strategy window settings window or/and do I need to enter the logic below in my code?
        You can set this from within the Strategies menu when configuring your strategy.

        Originally posted by simple_goodoboy View Post
        Also, Position.MarketPosition gets the "strategy's" current market position. Does this means that the strategy keeps track of the market position? This is not the same thing as tracking order status at the broker side right?
        Correct, this is the strategy keeping track of it's own internal position. For more information please visit the following link: http://ninjatrader.com/support/helpG..._account_p.htm

        Please let me know if you have any questions.

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          You can set this from within the Strategies menu when configuring your strategy.


          Correct, this is the strategy keeping track of it's own internal position. For more information please visit the following link: http://ninjatrader.com/support/helpG..._account_p.htm

          Please let me know if you have any questions.
          Thank you PatrickH

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by f.saeidi, Today, 11:02 AM
          1 response
          1 view
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by geotrades1, Today, 10:02 AM
          4 responses
          12 views
          0 likes
          Last Post geotrades1  
          Started by rajendrasubedi2023, Today, 09:50 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by lorem, Today, 09:18 AM
          2 responses
          11 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by geddyisodin, Today, 05:20 AM
          4 responses
          30 views
          0 likes
          Last Post geddyisodin  
          Working...
          X