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

outside bounds of the array

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

    outside bounds of the array

    Converting from Ninja 7 to 8. Keep getting index was outside the bounds of the array
    This worked ok in 7. Please help.

    Here's the code....

    private RSI DYNRSI;
    private SMA DYNPrice;
    private SMA DYNSignal;
    private SMA DYNAverage;
    private StdDev SDBB;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"xyz";
    Name = "xyz";
    Calculate = Calculate.OnBarClose;
    IsOverlay = false;
    DisplayInDataBox = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    IsSuspendedWhileInactive = true;
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Line, "PriceLine");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Line, "SignalLine");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Line, "Average");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Line, "Upper");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Line, "Lower");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Dot, "BaseLine");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Dot, "HighLine");
    AddPlot(new Stroke(Brushes.Gray), PlotStyle.Dot, "LowLine");
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar < 1)
    {
    return;
    }

    DYNRSI = RSI(Input,RSIPeriod,1);
    DYNPrice = SMA(DYNRSI,PricePeriod);
    DYNSignal = SMA(DYNRSI,SignalPeriod);
    DYNAverage = SMA(DYNRSI, BandPeriod);
    SDBB = StdDev(DYNRSI,BandPeriod);

    #2
    Hello,

    Thank you for the question.

    I tried this in a new script but I am not getting an exception, I am unsure of the test specifics that you were using.

    Could you provide an export of the script you are using as the error may not lie in this code and also the type of chart, and instrument.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      out of bounds array

      Hi Jesse,
      Attached is the entire script. I am using this on an ES 12-15 1min chart.
      Maybe you can spot the problem.
      Attached Files

      Comment


        #4
        Hello,

        I tried the attached file but have not received an error. Can you tell me are there further steps than what the video details? http://screencast.com/t/NFUNf1hqVYhp

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-17-2024, 06:40 PM
        5 responses
        46 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by arvidvanstaey, Today, 02:19 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by mmckinnm, Today, 01:34 PM
        3 responses
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by f.saeidi, Today, 01:32 PM
        2 responses
        8 views
        0 likes
        Last Post f.saeidi  
        Started by alifarahani, 04-19-2024, 09:40 AM
        9 responses
        55 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X