Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2D array to store the prices

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

    2D array to store the prices

    Hello,

    I'm creating a two-dimensional array to store the prices in.

    private double[,] priceArray = new double[1,200];

    An entry must be made when some condition is met.

    if(conditions)
    {
    priceArray[0, 0] = Close[0];
    }
    When, in the future, the price crosses the price from this array, the sign is drawn on the chart.

    But it turns out that the array priceArray[0, x] for all x contains only one last price value.

    ​Please tell me what am I missing.

    Regards

    #2
    Hello zhiga,

    Below is a link to the microsoft documentation on multidemensional arrays.
    Store multiple variables of the same type in an array data structure in C#. Declare an array by specifying a type or specify Object to store any type.


    If you are trying to save price values with bar numbers, you may want a dictionary or a keyvaluepair. Either would be general to C#.

    It looks like you are only assigning priceArray[0, 0] a value.

    Try assigning priceArray[0, 1] a value.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sjsj2732, Yesterday, 04:31 AM
    0 responses
    30 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    286 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    282 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    132 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    90 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X