BarMode

Determines the bar creation and trading behavior when the market is inactive, as on weekends, outside market hours, and at business holidays. By default, any bar must contain at least one price quote. When no price quotes arrive due to market inactivity, no new bars are created. This behavior can be changed with the following BarMode flags. Use | or + for combining flags and setf and resf for setting and resetting single flags.

Flags:

BR_FLAT Generate bars even when they contain no price quote. These bars get a flat candle with the close price of the previous bar. This flag must be set in the INITRUN before any asset calls.
BR_WEEKEND Don't generate bars at holidays and between EndWeek and StartWeek in the bar time zone (BarZone), even when they contain price quotes (default). This flag must be set or reset in the INITRUN before any asset calls.
BR_MARKET Don't generate bars between EndMarket and StartMarket in the bar time zone (BarZone), even when they contain price quotes. This flag is for intraday bars and must be set in the INITRUN before any asset calls.
BR_LEISURE Don't enter or manage trades between EndMarket and StartMarket, at holidays, and between EndWeek and StartWeek in the currently selected asset's time zone (AssetMarket). If AssetMarket is not set, BarZone is used instead. If neither is set, UTC time is assumed.
BR_SLEEP Don't request or process price quotes in the skipped time periods by BR_WEEKEND and BR_MARKET. This also causes tick functions not to run and price-dependent events not to be triggered during that time.
BR_LOGOFF Log off on weekend and holidays; only for special cases such as server shutdowns or API unresponsiveness on weekends. BR_SLEEP and BR_WEEKEND must be set. Broker API settings, such as order texts or price or volume types, are reset when logging off. Some broker APIs don't support logging off during a session at all.

Type:

int

Remarks:

Example:

function run()
{
  ...
  StartWeek = 10400; // start Monday 4 am
  EndWeek = 51900; // end Friday 7 pm
  BarMode = BR_WEEKEND+BR_SLEEP; // don't process quotes during the weekend and don't generate bars
  ...
}

See also:

bar, BarZone, MinutesPerDay, AssetMarket, StartWeek/EndWeek, Holidays

 

► latest version online