Replies

ivan-rifo
02 Aug 2017, 00:59

RE: Thank you very much again

Spotware said:

Hi ivan-rifo,

The problem is that in the loop you use NE as your array's index, which is always 0. Therefore the values are always assigned to N_array[0]. In the loop you need use i for the array's index and then introduce another variable that will start at 1.16660 will increase by 0.00001 in each loop. Let us know if you need any further assistance.

Best Regards,

cTrader Team 

Dear cTrader Team

Always your answer are very helpfull for me so Thank you very much for your help.

 

IR


@ivan-rifo

ivan-rifo
01 Aug 2017, 06:14

Dear cTrader Team,

Thank you very much for your help all the information is very hepfull for me. I'm less than a beginner in coding so i really appreciate your answer.

And would like to take the oportunity to make another question if you can help me again.

I'm trying to fill an array with the numbers of an interval just like the following example.

Min value: 1.16660

Max value: 1.16680

Total of elements: 22 

"Min value", "Max Value" and "Total of elements" are variables

and expecting the array it fills like this

{ 1.16660,1.16661,1.16662,1.16663,1.16664,1.16665,1.16666,1.16667,1.16668,1.16669,1.16670,1.16671,1.16672,1.16673,1.16674,1.16675,1.16676,1.16677,1.16677,1.16678,1.16679,1.16680}

I generated this code, just test it out in visual studio first.

                int NE = new int();
                int[] N_array = new int [NEM_S];
                for (int i = minv; i <= maxv; i ++)
                {
                    N_array[NE] = i;   
                }
                foreach(int element in Sell)
                {
                    System.Console.WriteLine(element);
                }

But just printed out {1.16680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} and i can't find my mistake.

Again thank you very much for your help

IR

 


@ivan-rifo