Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cross Above Question

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

  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • raker22
    replied
    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.

    Leave a comment:


  • koganam
    replied
    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.

    Leave a comment:


  • raker22
    started a topic Cross Above Question

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
157 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
91 views
1 like
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
143 views
2 likes
Last Post CaptainJack  
Started by CarlTrading, 03-30-2026, 11:51 AM
0 responses
131 views
1 like
Last Post CarlTrading  
Started by CarlTrading, 03-30-2026, 11:48 AM
0 responses
107 views
0 likes
Last Post CarlTrading  
Working...
X