Error : Method name expected // how do I fix this error. please
-
C# Code using System; using System.Collections; namespace Loop_Test { public class ForLoopTest { static void Main() { int Ticks = 0; int Bit = 0; int Ask = 0; int Bar1 = 22; for(int i = 0; i < 22 ( Bit + Ask) ; i++) Console.WriteLine("Bar1"); } } } This is one of bar from 22 Ticks ,Stock bar chart (Bid,Ask,Open,High,Low, Close). When bar close must have Variable (Bit&Ask) Total= 22; Can somebody help me with this loop. David.
-
C# Code using System; using System.Collections; namespace Loop_Test { public class ForLoopTest { static void Main() { int Ticks = 0; int Bit = 0; int Ask = 0; int Bar1 = 22; for(int i = 0; i < 22 ( Bit + Ask) ; i++) Console.WriteLine("Bar1"); } } } This is one of bar from 22 Ticks ,Stock bar chart (Bid,Ask,Open,High,Low, Close). When bar close must have Variable (Bit&Ask) Total= 22; Can somebody help me with this loop. David.
A few things: 1) Do you want to loop until (Bit + Ask) = 22? 2) The value of Bit,Ask and Bar1 are not changing from 0 3) If you want to display the value of Bar1 then you should put Console.WriteLine(Bar1.ToString()); (Console.WriteLine("Bar1") will display 'Bar1' and not the value of the variable Bar1)
for (int i = 0; (Bit + Ask) < 22; i++)
{
//Do something here to change the value of Bit and Ask - else infinite loop!!!
Console.WriteLine(Bar1.ToString());
} -
C# Code using System; using System.Collections; namespace Loop_Test { public class ForLoopTest { static void Main() { int Ticks = 0; int Bit = 0; int Ask = 0; int Bar1 = 22; for(int i = 0; i < 22 ( Bit + Ask) ; i++) Console.WriteLine("Bar1"); } } } This is one of bar from 22 Ticks ,Stock bar chart (Bid,Ask,Open,High,Low, Close). When bar close must have Variable (Bit&Ask) Total= 22; Can somebody help me with this loop. David.