Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy and sell stop order simultaneously

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

    Buy and sell stop order simultaneously

    Hi. I would like to create break out strategy, which find High and Low for specific time range and put buy stop order to High and put sell stop order to Low in one time and will wait for breakout, but ninja trader doesn't work if I use this code:
    EnterLongStop(High);
    EnterShortStop(Low);

    Could you help me?
    Thank you

    #2
    Hi Hanysfx,

    Thank you for posting.

    While your syntax is currently correct, you would need to index the High and Low in order for the system to understand the full placement of where to place the Stop orders.

    I.E.
    Code:
    EnterLongStop(High[COLOR="Red"][0][/COLOR]);
    EnterLongStop(Low[COLOR="Red"][0][/COLOR]);
    This references which bar value you would like the orders to be placed.

    You can also you the LowestBar and HighestBar to find the highest bar for so many bars ago and the lowest.
    http://www.ninjatrader.com/support/h...highestbar.htm
    http://www.ninjatrader.com/support/h...?lowestbar.htm

    I would also recommend to check the Log Tab of the Control Center for any possible errors from the NinjaScript.

    Additionally, you can use the TraceOrders = true; to check the orders and if any get ignored and why.
    http://www.ninjatrader.com/support/h...raceorders.htm

    Please let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by hanysfx View Post
      Hi. I would like to create break out strategy, which find High and Low for specific time range and put buy stop order to High and put sell stop order to Low in one time and will wait for breakout, but ninja trader doesn't work if I use this code:
      EnterLongStop(High);
      EnterShortStop(Low);

      Could you help me?
      Thank you
      Look in the Reference Samples forum ref: http://www.ninjatrader.com/support/f...splay.php?f=30, on this board, and you will find an exact example of what you are trying to do. Modify it for your needs.

      Comment


        #4
        answer

        High and Low are just variables(I have another name for this variables in code). Problem is, that Ninja trader maybe dont accept 2 stop order simultaneously. How can I solve this problem?

        Comment


          #5
          Hello hanysfx,

          Submitting limit orders in both directions can only be done with an unmanaged script. Using the managed approach you will not be able to achieve this.

          Below is a link to the help guide on SubmitOrder within the unmanaged approach. Please take a look at the OCOID.
          http://www.ninjatrader.com/support/h...ubmitorder.htm

          Also, below is a link to a strategy that is unmanaged and uses OCO.
          http://www.ninjatrader.com/support/f...atid=5&lpage=1
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,607 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          16 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X