Return a value into a method.

  • Thread starter Thread starter Frankdot
  • Start date Start date
F

Frankdot

Guest
Hello,


I am looking to return a value from a variable to my main method. I tried this:



var numbers = new List<double> {};

numbers.Add(nearclose);
numbers.Add(Close.GetValueAt(CurrentBar));


while (numbers.Count <= 3)
{
var previous = numbers[numbers.Count-1];
var previous2 = numbers[numbers.Count-2];

numbers.Add((previous *0) + (previous2*1));
}


foreach (var item in numbers)
{

fibo2 = (item - lowPrice0) / (Ncma - lowPrice0);




}





The idea is once

fibo2 = (Close.GetValueAt(CurrentBar)- lowPrice0) / (Ncma - lowPrice0);

nearclose return a value 10

fibo2 = (10- lowPrice0) / (Ncma - lowPrice0);

the value of nearclose 10 replace Close.GetValueAt.

and nearclose return a new value 11 and than 11 replace 10 in fibo2

fibo2 = (11- lowPrice0) / (Ncma - lowPrice0);

and it goes on.

but if i replace Close.GetValueAt by nearclose it will cause an internal loop and i wont access the next values.

How do i split the value from the variable, and return the value of nearclose in fibo2 to get a list of values?


TY

Continue reading...
 
Back
Top