Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossBelow

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

    CrossBelow

    I coded up a simple strategy that says short if price crosses below (CrossBelow)
    the low of the day, then enter short.

    So today, at 2:22pm, UPS stock hit its day low at 118.07, but never crossed below, and yet the strategy shorted at 118.07.

    What is wrong here and how can I avoid this?

    #2
    Hello, thanks for the post.

    The condition must have become true when the price hit the low. Can you please share your IF statement that determines your short market entry?

    I look forward to your reply.

    Comment


      #3
      hey, thanks for the response.

      Why does it come true if the price did not cross below? Thats what this code tells it to do. It does not say to short at or below, but only when it crosses below. I could not find any tick in any exchange that crossed below the mentioned price in my previous post.

      Am I wrong?

      If (CrossBelow(Low, CurrentDayOHL1.CurrentLow, 1)

      {
      EnterShort(Convert.ToInt32(100), @"short");
      }

      Comment


        #4
        Hello. Thank you for the reply.

        This condition will never become true when running properly. The low of the day will never cross below the CurrentDayOHL because they will always be the same value. The reason it activated for you was a special case where the strategy's OnBarUpdate was called before the OnBarUpdate for CurrentDayOHL was called, causing the cross above to become true. You must use the Update() method to make sure the OnBarUpdate method is called and updated for any indicators that are used in the strategies OnBarUpdate.

        Again though, this condition will never become true when the code is running properly.

        Please let us know if you have any questions.

        Comment


          #5
          Chris, thanks for the reply.

          All code is followed by OnBarUpdate. I don't see what is wrong here. Can you provide me an example of how it should be?

          Comment


            #6
            Hello.

            Thank you for the reply.

            I can provide an example if you reply with what you would like to do.

            I look forward to your reply.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            46 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            66 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X