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

Sequence of Orders question (Entry, Stop, Target)

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

    Sequence of Orders question (Entry, Stop, Target)

    Hello NT Support
    First thanks for being os proactive with your support - it's unique and really appreciated.

    I have a small question, as I go through the forums, I recall once reading that the sequence to place orders in terms of Entry, Stop and Target are important, but for some reason I can't recall if it should be to set the stop loss and profit target only after placing the entry order, or the other way.

    Meaning should it be:
    1. Place Entry
    2. Place Stop
    3. Place Target.

    OR

    1. Place Stop
    2. Place Target
    3. Place Entry


    I want to make sure to follow best practice. I know the first ordering is intuitive, but I thought I had read somewhere long ago it should be the 2nd ordering (but can't find where I read it).

    Thanks!!!
    faraway

    #2
    Hello farawayz,

    Thank you for your post.

    I'm not sure what post you are referencing, however you may be thinking of a post which discusses the fact that set methods (SetStopLoss, SetProfitTarget) cannot be unset. This means it is important to call the Set method with CalculationMode.Ticks to reset this before calling an entry method (not after).​

    If you want to dynamically change/modify the price of the stop loss and profit target, the method should be called from within OnBarUpdate() and the price should always be reset when the strategy becomes flat again. This information is noted in the "Tips" section on the following help guide pages:
    The reference sample script SamplePriceModification demonstrates how to change the price of stop loss and profit target orders:

    https://ninjatrader.com/support/helpGuides/nt8/modifying\_the\_price\_of\_stop\_lo.htm
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the quick response Gaby.

      More specially the issue I'm having, and the reason I asked about the sequence, is I'm seeing instances where my Target Profit and Stop Loss orders are placed, but an Entry is never placed. So that is confusing.

      Right now its in this order (and perhaps your reference calculationMode.tick comes into play)

      SetStopLoss(signalName, CalculationMode.T, stopPrice, false); // Set stop loss
      SetProfitTarget(signalName, CalculationMode.Price, targetPrice); // Set profit target
      EnterShort(contractsToTrade, signalName);


      Do you see any issue with this sequencing as to why it would sometimes create the Stop and Target, but not the entry?

      Thanks again I hope my question is clear!

      Comment


        #4
        Hello,

        I am not seeing any issue with just these statements creating stop loss and target and submitting a sell order. However more information is needed as to why the entry order is not placed.

        In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating and enable TraceOrders to see if orders are being submitted, ignored, rejected, or cancelled.

        https://support.ninjatrader.com/s/ar...nd-TraceOrders

        Enable TraceOrders, print the time of the bar and all values used in the conditions that submit entry orders. Include labels for all values and comparison operators.

        Let me know if you need any assistance creating a print or enabling TraceOrders.

        Save the output from the output window to a text file and provide this with your reply.

        I'll be happy to assist with analyzing the output.​
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Thank you so much Gaby, let me do some work on my end before I ask you again, I will try as you suggested.

          I will be in touch!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by mbafelfel, 05-05-2017, 06:12 AM
          5 responses
          1,367 views
          0 likes
          Last Post Rancher
          by Rancher
           
          Started by Blaze212, 07-07-2024, 08:58 PM
          3 responses
          23 views
          0 likes
          Last Post Blaze212  
          Started by yertle, Today, 12:24 PM
          0 responses
          4 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by reekotubbs, Yesterday, 01:09 PM
          3 responses
          28 views
          0 likes
          Last Post reekotubbs  
          Started by medicmiked, Today, 11:56 AM
          0 responses
          9 views
          0 likes
          Last Post medicmiked  
          Working...
          X