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

Cross problem in volatile market

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

    Cross problem in volatile market

    Hello, I am having problems with the condition "Cross above" or "Cross below" in times of volatility. For example, I have a condition that triggers when the price crosses an average but it has given me error I suppose for a sudden movement of the price. It is the reason I find him. Would that be possible? In that case, would the option of => or =< be better depending on the case?

    Thanks

    #2
    Hello herkok,

    Thanks for your post.

    What Calculate setting are you using? Calculate.OnBarClose, Calculate.OnPriceChange, Calculate.OnEachTick?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello herkok,

      Thanks for your post.

      What Calculate setting are you using? Calculate.OnBarClose, Calculate.OnPriceChange, Calculate.OnEachTick?
      OnPriceChange

      Comment


        #4
        Hello herkok,

        Thanks for your reply.

        With OnPriceChange this means your code will execute on every change in price and during volatile times it is certainly possible that a cross condition can be true on one price change and false on the next and repeating until price moves consistently in a direction. It is also possible that while the cross may be triggered, as price retreats it would look like the cross has not occurred.

        Basically a cross condition would be comparing the previous bar to the current bar to see if it is greater (or lessor) compared to the reference (other indicator or numerical value) to determine the cross condition.

        What is the error you are experiencing?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello herkok,

          Thanks for your reply.

          With OnPriceChange this means your code will execute on every change in price and during volatile times it is certainly possible that a cross condition can be true on one price change and false on the next and repeating until price moves consistently in a direction. It is also possible that while the cross may be triggered, as price retreats it would look like the cross has not occurred.

          Basically a cross condition would be comparing the previous bar to the current bar to see if it is greater (or lessor) compared to the reference (other indicator or numerical value) to determine the cross condition.

          What is the error you are experiencing?
          Well, the error jumped on the screen and I quickly removed it, right now I don't remember what it said. Anyway I think I have solved it with the condition <> =

          thanks

          Comment


            #6
            How did you solve it?






            ​I am a programmer, good at programming, web design, software development
            Last edited by donwynne; 09-13-2022, 08:39 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by traderqz, Today, 12:06 AM
            2 responses
            3 views
            0 likes
            Last Post traderqz  
            Started by RideMe, 04-07-2024, 04:54 PM
            5 responses
            28 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by f.saeidi, Today, 08:13 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by DavidHP, Today, 07:56 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by kujista, Today, 06:23 AM
            3 responses
            11 views
            0 likes
            Last Post kujista
            by kujista
             
            Working...
            X