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 must be set in the INITRUN before any asset calls.
BR_LEISURE Don't enter 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 inactive time determined by BR_WEEKEND, BR_MARKET, and/or BR_LEISURE. This also causes TMFs and tick functions and trade entry/exit limits (entry / stop / takeprofit / trail) not to be triggered during that time.
BR_LOGOFF Log off at weekend and holidays. BR_SLEEP and BR_WEEKEND must be set. Some broker APIs don't support logging off during a session.

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, AssetMarket, StartWeek/EndWeek, Holidays

 

► latest version online