Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cross Above Question

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

    Cross Above Question

    I am having problems implementing a simple crossover strategy . What I am trying to do is to get the current close to crossabove the High from 2 bars ago . It is simple enough to do close[0] > high[2] but as soon as I try ;

    CrossAbove(Close,High[2], 1) it does not work . Could you let me know how I can do a crossabove signal but linking to a previous bars value.
    thanks,
    Tim

    #2
    Originally posted by raker22 View Post
    I am having problems implementing a simple crossover strategy . What I am trying to do is to get the current close to crossabove the High from 2 bars ago . It is simple enough to do close[0] > high[2] but as soon as I try ;

    CrossAbove(Close,High[2], 1) it does not work . Could you let me know how I can do a crossabove signal but linking to a previous bars value.
    thanks,
    Tim
    What is the error in your log? Search the forum on that message and you will see a plethora of posts telling you that you need to ensure that there are enough bars to do what you want to do, the first time that your calculation is done.

    In your particular case, you will need:
    Code:
    if (CurrentBars < 2) return;
    placed close to, if not at, the top of your OnBarUpdate() method.

    Comment


      #3
      Hi there,
      There is no error log , it just does not plot and the system shows no results , when I was over at Neoticker it was pretty straight forward in that you could access previous valueof data series in their equivilent of the crossover function :

      This is Neoticker's version

      Long_Signal:= if(xabove(C(0),H(2)),1,0);

      Any idea how I can do this on Ninjatrader.

      Comment


        #4
        Hello,

        Thank you for the post.

        I tried the condition you are questioning and do see that it is able to become true but did see that it was infrequent depending on the instrument and settings used.

        Could you try the following code from an Indicator to see if you are able to see the dots drawn? I had tested on the ES 12-16 1 minute chart.

        This test could at least confirm the condition is working, if it works in a test indicator but does not in the script you are working on it may be other logic playing a role as well.

        Code:
        if(CrossAbove(Close,High[2], 1))
        {
        	DrawDot("dot" + CurrentBar, true, 0, Close[0], Color.Orange);	
        }
        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X