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 limit order - stop chasing the candles

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

    strategy limit order - stop chasing the candles

    Hi, I know I've seen the answer in here somewhere, but can't find it. How do i tell the strategy to stop moving the limit order up as candles close higher above it?

    #2
    Hello trader3000a,

    Thank you for your note.

    Could you give a code sample of how you're currently placing/moving the Limit order in the strategy so I can best offer guidance?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      if ((Close[0] > Open[0])
      && (Close[1] > Open[1]))
      {
      EnterLongLimit(Convert.ToInt32(DefaultQuantity), Median[0], "");
      }

      i'm sure it just keeps checking for 2 consecutive green candles if I'm flat, and then placing a new limit each time if the limit doesn't get hit, so i guess I'm wondering how to tell it to stop checking once the initial limit order is placed

      Comment


        #4
        Hello,

        Thank you for your reply.

        You could certainly use a bool. For example, if you make a bool called OrderPlaced, and set that to false, check that it's false before entering the order, then flipping the bool to true, you could then monitor in OnOrderUpdate for the order to be filled or cancelled and flip the bool back to false when that occurs to keep the order from firing again. Keep in mind that with limit orders the default behavior is to cancel the order once the conditions for entry are no longer true, so it'll get cancelled once the current and prior bar are no longer rising bars. If you want the order to stay live until cancelled, you can do that. Here's an example from our help guide on how to keep an order alive:



        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by burtoninlondon, Today, 10:13 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by ezrollin, 02-26-2022, 11:14 PM
        11 responses
        217 views
        0 likes
        Last Post kenz987
        by kenz987
         
        Started by Ticks_66, Today, 09:50 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Aquila_Welokk, 04-29-2024, 01:14 PM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
        3 responses
        22 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X