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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by nobeogdan, Today, 03:10 AM
        0 responses
        5 views
        0 likes
        Last Post nobeogdan  
        Started by quebequer, Yesterday, 06:51 AM
        4 responses
        33 views
        0 likes
        Last Post quebequer  
        Started by briendaluy, Yesterday, 11:38 PM
        0 responses
        8 views
        0 likes
        Last Post briendaluy  
        Started by MiCe1999, 04-23-2025, 09:26 PM
        4 responses
        60 views
        0 likes
        Last Post MiCe1999  
        Started by linneon, Yesterday, 09:04 PM
        0 responses
        12 views
        0 likes
        Last Post linneon
        by linneon
         
        Working...
        X