Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Chris L.NinjaTrader Customer Service

    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.
        Chris L.NinjaTrader Customer Service

        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.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by George21, Today, 10:07 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by geddyisodin, Yesterday, 05:20 AM
            8 responses
            50 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by DayTradingDEMON, Today, 09:28 AM
            3 responses
            20 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Stanfillirenfro, Today, 07:23 AM
            9 responses
            23 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by navyguy06, Today, 09:28 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X