Announcement

Collapse
No announcement yet.

Switch Command

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

  • Switch Command

    Does the standard Switch command from JavaScript work in EFS? Does anyone have an example?

    Thanks

  • #2
    Here you go..

    Hope this helps.


    switch (Step)
    {
    case 0:
    .. do something
    break;
    case 1:
    .. do something
    break;
    case 2:
    .. do something
    break;
    }
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      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;
      }

      Cheers.

      Andrei

      P.S.: I know because I am deep in it!

      Comment


      • #4
        Only If...

        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.

        Brad
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment

        Working...
        X