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

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.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          148 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          5 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post tkaboris  
          Started by GussJ, 03-04-2020, 03:11 PM
          16 responses
          3,282 views
          0 likes
          Last Post Leafcutter  
          Working...
          X