Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove and other script

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

    CrossAbove and other script

    Why is it that this code does not work.
    (myTSF works OK)

    private BoolSeries CxTSFup;
    CxTSFup = new BoolSeries(this); // Close crosses above TSF
    CxTSFup.Set(Close[1] < myTSF[1] && Close[0] > myTSF[0]);
    if (CxTSFup[0])
    When this code snippet is active, it compiles OK, but produces a blank pane,

    but, when I use
    if (CrossAbove(Close, myTSF, 1))
    the code produces the expected output.
    Thank you
    Old hiker
    Last edited by oldhiker; 12-29-2011, 10:06 PM.

    #2
    Originally posted by oldhiker View Post
    Why is it that this code does not work.
    (myTSF works OK)

    private BoolSeries CxTSFup;
    CxTSFup = new BoolSeries(this); // Close crosses above TSF
    CxTSFup.Set(Close[1] < myTSF[1] && Close[0] > myTSF[0]);
    if (CxTSFup[0])
    When this code snippet is active, it compiles OK, but produces a blank pane,

    but, when I use
    if (CrossAbove(Close, myTSF, 1))
    the code produces the expected output.
    Thank you
    Old hiker
    What message is on your log when you get the blank chart?

    Comment


      #3
      Hello koganam,
      Thank you for your speedy reply, The error log is as follows;-
      Error on calling 'OnBarUpdate' method for indicator 'MyComboLong' on bar 0. You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series[barsAgo] with a value of 5 when there are only 4 bars on the chart.
      I do not understand this error message, as there are plenty of bars loaded (standard loading)
      Would it have any connection to another indicator that uses the same script?
      Thank you,
      Old Hiker

      Comment


        #4
        I would suggest that you look at my response in this thread.

        ref: http://www.ninjatrader.com/support/forum/showthread.php?t=41781

        Comment


          #5
          Thanks Koganam.

          Sample can be provided here as well.



          Let me know if I can be of further assistance.
          BrettNinjaTrader Product Management

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          152 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          89 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          131 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          127 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