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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      151 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      304 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      345 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      175 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X