BarMode

Determines bar creation and trading behavior when the market is inactive, as on weekends, outside market hours, and on business holidays. By default, any bar contains at least one valid price quote. When no price quotes arrive due to market inactivity, or when it's weekend or a holiday, no 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 flat candles with the close price of the last quote. For special purposes only; price and indicators series should normally skip flat periods. This flag affects bar creation and must be set before the first asset call.
BR_WEEKEND Don't generate bars that end on holidays or at or after EndWeek and before StartWeek in the bar time zone (BarZone), even when they contain price quotes. This flag is set by default. It is for intraday bars, but also affects EOD bars. It affects bar creation and must be set or reset before the first asset call.
BR_MARKET Don't generate bars that end at or after EndMarket and before StartMarket in the bar time zone (BarZone), even when they contain price quotes. This flag is for intraday bars only. It affects bar creation and must be set before the first asset call.
BR_NOSHIFT Don't shift data series on intraday bars that end at or after EndMarket and before StartMarket in the bar time zone (BarZone). This prevents series-based indicators from updating or generating trade signals outside market hours. Start and end time and zone can be individually set up in the asset list.
BR_LOCAL Automatically set Start/EndMarket on any asset call to the local asset market hours (AssetMarketStart/End), converted from AssetMarketZone to BarZone
BR_LEISURE Don't enter or manage trades at or after EndMarket and before StartMarket, on holidays, and on weekends by EndWeek/StartWeek in the bar time zone (BarZone).
BR_SLEEP Don't request or process price quotes when the market is closed due to BR_WEEKEND and BR_MARKET. Since no prices are updated, tick functions will not run and price-dependent events will not to be triggered during that time. Use this for special purposes only.
BR_LOGOFF Log off on weekends or when the market is closed. BR_SLEEP and BR_WEEKEND must be set. Broker API settings, such as order texts or price or volume types, are usually reset when logging off. Use this for special purposes only, such as working around server maintenance or API unresponsiveness on weekends. Some broker APIs do not support logging off during a trading session; in that case BR_LOGOFF will suspend the session until it is manually restarted.

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:

Bars, BarPeriod, NumBars, BarZone, MinutesPerDay, AssetZone, StartWeek/EndWeek, Holidays

 

► latest version online