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

Why strategy takes only LONG trades?

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

    Why strategy takes only LONG trades?

    I am coding the strategy, and face a problem.


    it only enters the long side (and also does "sell"), however, it never enters short...
    when in flat, it executes such bracket on the same execution:

    EnterLongStopMarket(..High..)
    EnterShortStopMarket(..Low...)

    however, only longs are being executed when it's flat (even though if the LOW is broken on next bar, instead of high, then nothing happens, while i hoped it should enter short)

    #2
    Hello TazoTadua,

    Thanks for your post.

    Internal rules of the Managed Approach will prevent you from placing successive non market orders as entry orders in the opposite direction. EnterLong() and EnterShort() could be used to reverse the position, however, the Enter methods for non market orders cannot be placed at the same time.

    I've included a note from the help guide below:
    Methods that generate orders to enter a position will be ignored if:
    • A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
    • 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
    • The entry signal name is not unique
    More information on these internal rules can be referenced here - https://ninjatrader.com/support/help...antedPositions

    The Unmanaged Approach does not apply this restriction and would be advised if you would like to model that behavior.

    Please let us know if you have any additional questions.
    Last edited by NinjaTrader_Jim; 09-27-2018, 07:16 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      oh
      once again, lets say:
      calculate is set to OnBarClose.
      i am flat on bar #1 (and price closed at 100), and on that bar i want to have issued such thing:

      long stop entry at 101
      or
      short stop entry on 99
      so, if next bar touches 101 (on bar #2), then there i should see Long entry.
      if it touched 99, then .. sellShort


      however, if i use Market orders (like, `if (price>101) MktOrder`) the there will be 1 bar delay, and order executes on bar #3. I wanted to have entered on #12.

      all of these cant be done without unmanaged approach ? no workarounds, right?
      Last edited by ttodua; 09-27-2018, 10:11 AM.

      Comment


        #4
        Hello TazoTodua,

        The rules are built into the Managed Approach. Only an Unmanaged Approach strategy can model a bracketed entry.

        From the Managed Approach, you may be able to create logic to take a different approach by calculating on price changes, checking if the current market price reaches a certain level to submit a market order, and then use intrabar granularity or High Order Fill Resolution to simulate order fills with tick data instead of the bar's OHLC values.

        Intrabar granularity - https://ninjatrader.com/support/help...ipt_strate.htm

        Histoprical Fill Processing (High Order Fill Resolution) - https://ninjatrader.com/support/help...ical_fill_.htm

        I've also included an example Unmanaged strategy that could be referenced for setting up a bracketed entry with OCO.

        Unmanaged Approach documentation can be found here - https://ninjatrader.com/support/help...d_approach.htm

        Please let us know if you have any additional questions.
        Attached Files
        Last edited by NinjaTrader_Jim; 10-01-2018, 12:48 PM.
        JimNinjaTrader Customer Service

        Comment


          #5
          thanks, however, I've submited feature request to allow that in Managed approach - https://ninjatrader.com/support/foru...d.php?p=555021

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rocketman7, Today, 02:12 AM
          7 responses
          30 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by guillembm, Yesterday, 11:25 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by junkone, 04-21-2024, 07:17 AM
          10 responses
          149 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by tsantospinto, 04-12-2024, 07:04 PM
          6 responses
          101 views
          0 likes
          Last Post tsantospinto  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          7 responses
          28 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X