Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Values[3][0] returning error

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

    Values[3][0] returning error

    Hi,

    I am working on an indicator that uses Values[x][x] variables.

    I added AddPlot for all of them, created the code, but at the Values[3][0] i get error.
    Part of my code :

    [CODE]

    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 500)
    return;​


    if ( x < y )
    Values[1][0] = 1;
    else Values[1][0] = 0;

    if ( x1 < y1 )
    Values[2][0] = 1;
    else Values[2][0] = 0;


    if ( x2 < y2 )
    Values[3][0] = 1;
    else Values[3][0] = 0;
    [CODE]

    I added prints to each section, and at the third section I get an error, regardless of how many bars i set to countedbars.
    I read the documentation about Values function, but am I still missing something?












    #2
    Hello gyilaoliver,

    How many AddPlot statements do you have in the script?

    The indexes that you are using, 1,2,3 would mean that you should have 4 total AddPlot statements. If you mean to have only 3 plots the indexes should instead be 0,1,2.

    Comment


      #3
      Oh I see, then this is what i am missing... I only have 3 AddPlot statements, now i get the error. Thank you very much for your help Jesse

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X