Insider 3000 :  Features  |  Forum  |  Help on Line  |  FAQ  |  Download  
Home  |   Trading Systems and Indicators  |   Upcoming release news  |   News
Order Insider 3000   |   Resellers - Agents
English    English    Italiano
    Open security
Workgroups
Data file Explorer
Layout
    Windows
Inner Windows
Tooltips
AutoRefresh
Print Chart
    Zoom
Zoom
    Control Panel
Introduction
Charts Properties
Windows Properties
Grids properties
Indicators Properties
Studies Properties
Trading Systems Properties
    Indicators and Studies
Adding an indicator
Modifying an Indicator
Transfer indicator between windows
Deleting an indicator
Adding Studies
Modifying an object
Deleting, coping, cutting, pasting an Object
Indicators Lists
    Data files Management
Introduction
Creating, deleting and modifying Archives
File Format
Historical DDE
Web Server
Archives Update
Edit periods
Deleting periods range
Copy Data to Clipboard
Text file import Wizard
Export data on text file Wizard
Rollover Wizard
Scheduled export on text file
    Analysis
User Indicators Management
Trading Systems Management
Explorers management
Real time alerts windows
Graphical alerts
Pivots Explorer
Candlestick Rules
Candlestick forecaster
Candlesticks signals on chart
Trading systems signals on chart
Statistics
Export - Import source code
    Real time data providers
Providers
    Find Window
Find Window
    Programming language
Introduction
Operators
Data types
Functions
Function, EndFunction
Return
Variables declaration: Dim
Comments
Warnings
The MAIN function
If, Then ... Else
Goto ... label
For ... Next
Do Until ... Loop
Select ... Case
Array
Error Handling
Module variables
Costants
Include (including secondary modules)
Properties
Option (trading systems options)
PRICE keyword (for trading systems)
DATABASE keyword
Special Functions (they change their output depending on the context)
System functions available in the programming language
Indicators Functions
Data Functions
Math Functions
Analysis tools Functions
Date Functions
Boolean Functions
String Functions
Other Functions
Programming Language Editor
    Send Email
Send Mail - Mailer
    Real Time - DDE
Introduction
Subscriptions
Data receiving
    Real Time - Web Server
Introduction
Web Server configuration
Subscriptions
Data receiving
    Real Time - Txt
Introduction
Text file configuration
Subscriptions
Data receiving
    Mailer
Introduction
Mailer Configuration
Emails list
Select ... Case

The Select Case statement is very useful when there is the need to do different things according with an expression value which can have multiple options. Alternatively it is possible to use many If statements, but when the values to test are many, the use of Select Case will assure a more practical and efficient operation.

Let's see how it is the command syntax:

Select Case (Main Expression)
Case(Expression1)
    "Block of instructions"

Case(Expression2)
    "Block of Instructions"

Case(Expression3)
    "Block of Instructions"
    ... other Case ...

Case Else
    "Block of Instructions"

EndSelect

First of all the command interpreter will get the value of the "Main Expression" Then it will start from the first Case to the last to check the expression of each Case and compare it with the value of the Main Expression. The first time to condition is met, the corresponding Instructions Block will be executed, and all the other parts of the statement will be ignored. If no condition will be satisfied and a Case Else statement exists (being optional) then will be executed the Instructions Block after Case Else, or otherwise nothing will happen.

Let's see an example which will help to understand the flow.

    ...
    ...
    ...
MyValue = 10

Select Case MyValue
Case 1
    S = "2"

Case 10
    For a = 1 To 10
        S= S & "A"
    Next a

Case 20
    S = S & "M"

Case Else
    S = ""

EndSelect
    ...
    ...
    ...

"MyValue" is a variable. Before entering the Select Case statement, the variable has been set to 10 (this for simplicity, but it could well have been the result of an expression).

The command interpreter will compare the value of "MyValue" (which is 10) with the expression on the first Case. In this case, the expression to compare evaluates as 1, therefore not equal to 10, which is the value of "MyValue". The second Case is tested. In this case the value of the expression (10) is exactly equal to the value of MyValue (10). Therefore are executed the instructions contained in the second Case statement. When the execution of this set of instruction has been executed, the control will exit from the Select Case, continuing with the following instructions.

So all the other instructions for different cases have not been executed.

NB In case the value of MyValue would have been 100, the command interpreter would not have found any matching expression so the block of code immediately following the Case Else will have been executed instead. If this last condition was missing the no other code will be executed and the control of the program will continue with the subsequent lines.

Contact us    Collaboration
TraderSoft s.r.l. 2003-2010 - P.Iva 03808860286 - Copyright