Jump to content
Medved Trader Forums

Is it possible to declare and use a CurrentState variable as an array?


Thebattlefront

Recommended Posts

Hello, I have been having a bit of trouble getting arrays to work with the CurrentState variables. For example: This line of code:



Works without any issues. The debugging log and the chart shows the correct PBShapes and Colors for those shapes, so I know the code is working. However, if I were to declare a new CurrentState variable in this way:



}

 



 



}

And then subsequently write the line of code:



The debugging log below the code lines does not return any immediate error in the coding. However, a red "X" displays on the Chart next to the PaintBar's name in the top left and the PBShapes and Colors don't show on the chart as well. So I was wondering if I have declared or defined something incorrectly, or if possibly the CurrentState function doesn't support array type variables. 

 

 

 

Link to comment
Share on other sites

Wow I really messed up the formatting. How do i delete this lol

I will rewrite it here again instead:

Is it possible to declare and use a CurrentState variable as an array?

Hello, I have been having a bit of trouble getting arrays to work with the CurrentState variables. For example: This line of code:

double[] abc_Vector = {1, 2, 3, 4};

double abc = abc_Vector[1];

Works without any issues. The debugging log and the chart shows the correct PBShapes and Colors for those shapes, so I know the code is working. However, if I were to declare a new CurrentState variable in this way:

 private void PaintbarInitialize()

{

CurrentState.m_dTest = new double[4] {0, 0, 0, 0};

}

private struct PaintbarState

{

public double[] m_dTest;

}

And then subsequently write the line of code somewhere in any another function:

 double abc = CurrentState.m_dTest[1];

The debugging log below the code lines does not return any immediate error in the coding. However, a red "X" displays on the Chart next to the PaintBar's name in the top left and the PBShapes and Colors don't show on the chart as well. So I know something running inside the program is having a problem. And the only thing that I've changed from the working program, to the one that is not working, is the declaration of the CurrentState array variable. So I was wondering if I have declared or defined something incorrectly, or if possibly the CurrentState function doesn't support array type variables. 

 

EDIT: Apparently I can't copy paste code from the Paintbar directly into a post. It turns up empty.

EDIT: I typed it in manually instead

Edited by Thebattlefront
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...