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 charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            60 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            147 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            161 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            97 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            284 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Working...
            X