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 Noerclou, Today, 04:55 AM
          0 responses
          2 views
          0 likes
          Last Post Noerclou  
          Started by llanqui, Yesterday, 09:59 AM
          2 responses
          16 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by ThoriSten, Today, 03:56 AM
          0 responses
          6 views
          0 likes
          Last Post ThoriSten  
          Started by PhillT, 04-19-2024, 02:16 PM
          3 responses
          20 views
          0 likes
          Last Post mangel2000  
          Started by TraderBCL, Today, 02:37 AM
          0 responses
          4 views
          0 likes
          Last Post TraderBCL  
          Working...
          X