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

Entries Per Direction

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

    Entries Per Direction


    Hi All

    I am experimenting with multiple entries per direction.

    Once an order has been filled by my strategy in Strategy Builder, let's say a short entry, is there a way of stopping any more entries in a defined zone around the last entry price. IE 20 ticks in either direction. Unfortunately I am getting multiple fills in a tight zone.

    Thank you in advance for any help.


    #2
    When you get a new fill (OnExecutionUpdate) make a note of the position's average entry price (Position.AveragePrice) and then don't place any more entry orders within 20 ticks of there? (Math.Abs(Close[0] - SavedPositionAveragePrice) / TickSize) > 20)
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Bruce,
      this solution requires writing NinjaScript code outside of Strategy Builder.
      In Strategy Builder you can't use "OnExecutionUpdate" method, you can only use "OnBarUpdate".
      Plus, in Strategy Builder you can't write a formula like this: (Math.Abs(Close[0] - SavedPositionAveragePrice) / TickSize) > 20)

      Comment


        #4
        I see. NinjaTrader Support can advise if it is possible to do what you are asking in Strategy Builder as I am not certain of the limits of its capabilities and suspect this might be a bit complex for what can be coded there but hopefully we will both be pleasantly surprised that they have a way to suggest.
        Bruce DeVault
        QuantKey Trading Vendor Services
        NinjaTrader Ecosystem Vendor - QuantKey

        Comment


          #5
          Hello nymexwti,

          Thanks for your post.

          You could try using a bool variable to control when trades are being placed by the strategy when the current market price (Close) is greater/less than the Position.AveragePrice offset by a set number of ticks.

          A bool variable could be created on the Inputs and Variables screen of the Strategy Builder. You could then try checking if you are in a short position by creating a condition that checks if Position.MarketPosition (Strategy folder > Current market position) is equal to MarketPosition.Short (Strategy folder > Market position > Short). Also, try creating conditions in the same Set that checks if the current Close price (Price folder > Close) is greater than or equal to Position.AveragePrice (Strategy folder > Average position price) offset by a set number of ticks, such as 20 ticks. and a condition that checks if the Close price is less than or equal to Position.AveragePrice offset by -20 ticks. In the Actions section, you would flip the bool to true. Then, you could check if your bool is true in another Set and place your other Entry order.

          By doing this the bool will be true when the market price (Close price) is greater than or equal to Position.AveragePrice + 20 Ticks and when the market price (Close) is less than or equal to Position.AveragePrice - 20 Ticks.

          Note that you would also need to create conditions that check if the Close price is within that price range of Position.AveragePrice offset by +/- 20 ticks and flip the bool to false when you don't want trades being placed or the bool will remain true.

          Conditions: https://ninjatrader.com/support/help...on_builder.htm
          Actions: https://ninjatrader.com/support/help...t8/actions.htm
          Brandon H.NinjaTrader Customer Service

          Comment


            #6
            Thank you Brandon

            Comment

            Latest Posts

            Collapse

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