Seer logo - advanced backtesting for stock, futures and forex trading systems using using technical analysis indicators, charts, money management and position sizing
Functions by Category Functions by Alphabetical list

if

Usable in an seer event objectUsable in an seer indicator objectUsable in an seer chart object

Used to control the flow of your system.

There are several different ways to use this function:

    STATEMENT if EXPR
    if (EXPR) BLOCK
    if (EXPR) BLOCK else BLOCK
    if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK

A BLOCK is a set of statments enclosed in braces {}
A EXPR is the expression that is being tested/evaluated against
A STATEMENT is a single statment

Examples:

  BuyOpen if ClosePrice>OpenPrice;# Buy if the close was higher than the open

  if (ClosePrice>OpenPrice) {
    Output('Close is higher than Open');
    BuyOpen;
  }
  # Same as example above, but since we have more than one statement
  # we have to enclose the statments in a block.

  if ($answer==0) {
    Output('The answer is zero');
    }
  else {
    Output('The answer is not zero');
    }

  if ($answer==0) {
    Output('The answer is zero');
    }
  elsif ($answer==1) {
    Output('The answer is one');
    }
  elsif ($answer>1 and $answer<10) {
    Output('The answer is between 2 and 9');
    }
  else {
    Output('The answer is some other value');
  }

Related functions:

© 2011 seer trading systems ltd
feedback FAQ legal privacy