• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterShortStopLimit

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

    EnterShortStopLimit

    Hi, need help with my entry/stop logic. Here’s what I want to do: execute a short trade at a certain price level below the current bid price. To do this, my strategy executes an EnterShortStopLimit at that lower price level while the current price is still above it. (fyi, I use the long form of that method as I need to set isLiveUntilCancelled to true so the order doesn’t cancel at the end of the bar.) I also set the EnterShortStopLimit stopPrice at 5 ticks above the EnterShortStopLimit limitPrice.

    As soon as the current price moves to the EnterShortStopLimit limitPrice and my strategy enters a short position, I then want to reset my EnterShortStopLimit stopPrice value based on some other variables I’m calculating. To do this, I then execute a SetStopLoss for that new stop price. This is where I consistently get the message “Stop price can’t be changed below the market”.

    I’ve looked at some example strategies to see where I’m going wrong but couldn’t find anything. I’m sure my use of the above commands, or where they are placed is flawed. Any insight you can provide is greatly appreciated! Thanks

    #2
    Hello pman777,

    Thanks for your post.

    We recommend debugging your strategy by printing the variables that are "based on some other variables I’m calculating" to ensure that an appropriate price is being used for the SetStopLoss(). Here is a link to our debugging tips: https://ninjatrader.com/support/help...script_cod.htm

    Can you clarify if this is correct, "I also set the EnterShortStopLimit stopPrice at 5 ticks above the EnterShortStopLimit limitPrice." I'm not sure why you would do that because then the order would be placed above the current price. Did you mean ExitShortStopLimit?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you Paul for replying so quickly. I did debug and the value is what I expected.
      Let me explain my thinking when I said "I also set the EnterShortStopLimit stopPrice at 5 ticks above the EnterShortStopLimit limitPrice." I’m assuming that this the stopPrice once my order is executed and price falls thought the limitPrice to place me in a short position. I realize I may be thinking about this wrong. I’m not sure if I should be using an ExitShortStopLimit?

      Is there an example strategy you can direct me to that uses a Managed EnterShortStopLimit and ExitShortStopLimit where the stopPice for an active order is modified?

      Comment


        #4
        Hello pman777,

        Thanks for your reply.

        There would be no example code because using Exit methods with SetStopLoss would violate the Internal Order Handling Rules that Reduce Unwanted Positions. Reference: https://ninjatrader.com/support/help...d_approach.htm

        Regarding SetStopLoss(), you will need to set the price level before you enter the position because the SetStopLoss() retains the last price you used for the stop and then immediately applies the stop upon entry and that likely would be the issue.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Ignoring what I was doing (previous comments) is there a strategy example you can direct me to where either a SellStopLimit or a BuyStopLimit is being used (Managed approach). I don't think I'm understanding how to structure these entries ... an example may help. thanks again

          Comment


            #6
            Hello pman777,

            Thanks for your reply.

            I'm not aware of an example so I created a quick one using EnterLongStopLimit().
            Attached Files
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              thanks Paul ... that's a great start for me! Appreciate it.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NinjaCustomer, Yesterday, 11:35 PM
              0 responses
              2 views
              0 likes
              Last Post NinjaCustomer  
              Started by sdauteuil, Yesterday, 11:29 PM
              0 responses
              1 view
              0 likes
              Last Post sdauteuil  
              Started by williamzz, Yesterday, 09:50 PM
              0 responses
              19 views
              0 likes
              Last Post williamzz  
              Started by Steve L, Yesterday, 05:01 PM
              0 responses
              6 views
              0 likes
              Last Post Steve L
              by Steve L
               
              Started by Trader-Joe, Yesterday, 04:06 PM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Working...
              X