Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy to buy the high and sell the low of the current bar

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

    Strategy to buy the high and sell the low of the current bar

    Hello,

    Seems like it would be simple but I'm not sure how to code it. I just want a strategy to buy the high + 1 tick of the current bar and sell the low - 1 tick of the current bar using stoplimit orders.

    Thank you for any help.

    #2
    Hello,

    A strategy that has this sort of OCO entry order handling requires the use of our unmanaged approach: http://www.ninjatrader.com/support/h...d_approach.htm

    We have an example of this here: http://www.ninjatrader.com/support/f...tid=-1&lpage=1

    If you wanted to stick with the managed approach you would need to create a condition that only places one entry order at a time.

    Let me know if I can further assist.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thank you Lance

      Comment


        #4
        Originally posted by kevinh786 View Post
        Hello,

        Seems like it would be simple

        You´d think...!

        I wanted to do something similar, but based on the high and low of previous bar - I was told its not possible. You can do it, but the entries and exits will not be in the right place, apparently. Not sure what point there is to that.

        Comment


          #5
          Hello ScottieDog,

          What is it you were told is not possible?
          LanceNinjaTrader Customer Service

          Comment


            #6
            Capturing all attributes from PREVIOUSLY formed bar

            I wanted to follow up on this question.
            Can you kindly show me the NT documentation on bar value capturing?
            I'm looking to capture all values.......not just the high/low/open/close.

            I'm talking about the symbol, the contract month, the contract year (if its a future).
            For example if I'm trading Oil futures, I want to capture the following and send to an excel file (or any file output):
            -symbol name CL 03-14 (Crude oil, March 2014 contract)
            -high of the previous formed bar (98.50, for example)
            -low of the previous formed bar (98.25, for example)

            so the following values would be sent to my output file:

            CL 03-14
            98.50
            98.25

            Please let me know where I can find such documentation on capturing and referencing previously formed bars.

            Thank you.

            Comment


              #7
              To get the instrument name, you can get the Full Name from here:



              To reference the High of the previous bar, you would use High[1] and the Low would be Low[1]

              Please see our Tips section on using [] brackets:



              We also have a reference sample on Writing to a file using StreamWriter which may help:

              MatthewNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X