Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set the entry price based on yesterday's high

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

    Set the entry price based on yesterday's high

    For my trading rules, I would like to set the entry price based on the previous day's high.

    For a long position, I want the system to enter the market as soon as the price exceeds yesterday's high.

    If today's price does not exceed yesterday's high, then the computer should not create a long position.

    Is this possible? So far I have only been able to get NT to enter the market a day late.

    Thanks for any suggestions!

    #2
    Originally posted by blitz View Post
    For my trading rules, I would like to set the entry price based on the previous day's high.

    For a long position, I want the system to enter the market as soon as the price exceeds yesterday's high.

    If today's price does not exceed yesterday's high, then the computer should not create a long position.

    Is this possible? So far I have only been able to get NT to enter the market a day late.

    Thanks for any suggestions!
    In that case you can try record the high price of the previous day or simply use the Swing Indicator of Ninja and get the Swing.High of it and compare it to the High[0] of the day.

    Comment


      #3
      Hello blitz,
      Welcome to the forum and I am happy to assist you.

      Yes, you can use the PriorDayOHLC indicator to do it.

      Code:
      if (Close[0] > this.PriorDayOHLC().PriorHigh[0])
      {
         //do something
      }
      JoydeepNinjaTrader Customer Service

      Comment


        #4
        Thanks for the help guys (and warm welcome!)

        Comment


          #5
          I have been playing around with comparing the price to the previous day's high. But so far it doesn't seem to be working. I took a screenshot of the code and the problem! Anybody have an idea where I am going wrong? It is probably something obvious as I am new to this! Thanks for any input!


          Comment


            #6
            Hello blitz,
            The PriorDayOHLC indicator works with intraday data only. Since you are using Daily chart, you can simply use the following code.

            Code:
            if (CurrentBar > 1 && Close[0] > High[1])
            	EnterLong(0, 1, "");
            JoydeepNinjaTrader Customer Service

            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