Announcement

Collapse
No announcement yet.

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?

    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?

        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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            47 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            23 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            33 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Working...
            X