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

Crossover Vs greater than /less than clarifications

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

    Crossover Vs greater than /less than clarifications

    Also looking for some clarification regarding the, bars ago feature.

    So first up when looking for a specific time WHEN one plotted line crosses another should you use the Crossover/ crossunder feature? Vs the plotted value simply being over the other plotted value, which is what the greater/less than feature is? what about articulating both in a strategy separately will this prevent what I call tickabove and immediate tick below false signals?

    Also regarding the bars ago does this mean at any time between current bar and X number of bars ago? or is it articulating a specific number of bars ago only?

    #2
    Hello Daryl,

    Thanks for your questions.

    CrossAbove and CrossBelow will look for a cross that happens going so many bars back as specified for the barsAgo. It will look for the value being "crossed over" rather simply "being above."

    what about articulating both in a strategy separately will this prevent what I call tickabove and immediate tick below false signals?
    I may not understand the question fully, so please provide clarification if it sounds like I am missing the picture. Between an indicator and a strategy, using the same logic on the same data should have the same result.

    Now if you mean false positives, for example, where you are calculating on each tick and a cross over occurs on an incoming tick before the bar closes, and then the bar closes and the indicator plot is no longer at a level that would signal a crossover, this would be a limitation for detecting cross overs on a pending value before it is locked into the indicator plot.

    Also regarding the bars ago does this mean at any time between current bar and X number of bars ago? or is it articulating a specific number of bars ago only?
    It would be representing "within the last X bars" You may observe with the following test that you will receive 5 prints for each bar after the crossover have occurred.

    Code:
    protected override void OnBarUpdate()
    {
    	if (CurrentBar < 1)
    		return;
    	if(CrossAbove(SMA(1), 2830, 5))
    		Print("Cross");
    }
    Please let me know if I can be of additional help.
    JimNinjaTrader Customer Service

    Comment


      #3
      It might require setting multi stage multi condition variables but the idea would be to detect _that_ a cross over has occurred, and that it hasn't just instantly crossed back the other direction again. I think you've clarified things for me pretty well. here. Especially the point about separating the cross over Lookback distinction from the bars ago distinction. It would appear that both are essentially a moving window that is inclusive of all bars within it.

      Originally posted by NinjaTrader_Jim View Post
      Hello Daryl,

      Thanks for your questions.

      CrossAbove and CrossBelow will look for a cross that happens going so many bars back as specified for the barsAgo. It will look for the value being "crossed over" rather simply "being above."


      I may not understand the question fully, so please provide clarification if it sounds like I am missing the picture. Between an indicator and a strategy, using the same logic on the same data should have the same result.

      Now if you mean false positives, for example, where you are calculating on each tick and a cross over occurs on an incoming tick before the bar closes, and then the bar closes and the indicator plot is no longer at a level that would signal a crossover, this would be a limitation for detecting cross overs on a pending value before it is locked into the indicator plot.


      It would be representing "within the last X bars" You may observe with the following test that you will receive 5 prints for each bar after the crossover have occurred.

      Code:
      protected override void OnBarUpdate()
      {
          if (CurrentBar < 1)
              return;
          if(CrossAbove(SMA(1), 2830, 5))
              Print("Cross");
      }
      Please let me know if I can be of additional help.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Started by alifarahani, Today, 09:40 AM
      6 responses
      41 views
      0 likes
      Last Post alifarahani  
      Working...
      X