Shouldn't one increment each case so that it moves to the next one i.e. at the end of case 0 add step++, should it?
switch (Step)
{
case 0:
.. do something
step++
break;
case 1:
.. do something
step++
break;
case 2:
.. do something
step0 //to return back to case 0
break;
}
Only if you want to control the "switched" variables within the switch statement.
For example. Let's say you had a variable called "TradeCondition" and defaulted it to ZERO. In this case (give the fact that it is being used to control the condition of the trading system), you may want to increment this variable within the switch function.
Now, let's assume you had a variable called "ActiveLevel" (used for support/resistance levels) and wanted to have your function determine which level was currently active. You would use the switch function to identify the "ActiveLevel" variable and do something.
"Swtich" is very much like a bunch of "IF"s.
The answer to your question is... Yes, you can STEP your switch function if you want/need to. It is not required though.
Comment