A bar is the basic time period for trade strategies. In the chart below, of the EUR/USD price in summer 2009, every bar is represented by a red or green candle. The horizontal width of the candle is the bar period (in the chart below, one day), and its vertical height is the price movement of the asset during that period. On green candles the price went up during the bar period; on red candles it went down. In Zorro charts, up or down bars are normally represented with white and black candles. The thin lines above and below the candles - the 'wicks' - represent the highest and the lowest price during the bar period.
For example, when you look at the candle of June 1 (at the vertical line below marked Jun), you see that the day started at a price of 1.4125. During the day the price went as high as 1.4225, and as low as 1.4110. The day ended with the price at 1.4135.
In past times, a bar was really equal to a day. The closing price was the price of the asset at 4 PM when the market closed, and the opening price was the first price next morning at 9:30 after the traders had contemplated their strategies all night. In modern times, assets are often traded online 24 hours a day, so there is no real opening and closing. Due to the trading around the clock, you can see that in the above chart the closing price of one bar is usually almost identical with the opening price of the next bar. This can be different when an asset is mainly traded at a certain stock exchange and has little or no trading volume outside its business hours. In that case, daily candles can have a gap between the close of a bar and the open of the next bar.
If an asset is trade around the clock, the form of its candles - the relation of their open, high, low, and close prices - mainly depends on the time zone in which the chart is taken. The EUR/USD chart above is based on Greenwich Mean Time (UTC); the same chart in New York time would have the same price curve, but with very different candles. By the convention used by Zorro, all times are UTC and the time stamp associated to a bar is its close time. Thus, a 12:00 bar is the bar that ends at 12:00 UTC.
Zorro's trading is based on ticks, bar periods, and time frames. In live trading, a tick is the arrival of a new price quote, which can happen many times per second. In the backtest, a tick is the smallest time unit of the historical price data, often 1 minute. The strategy script is run at the end of every bar period; it can also have a tick function that runs at every tick. Since ticks arrive rarely or not at all during weekends or holidays, and since Zorro allows bar periods down to a millisecond (for HFT simulation), bars can be much shorter than the distance between ticks. In such a case, the bar is extended by the multiple of the bar period until it contains at least one tick. Bars can also be artificially extended for skipping weekends, holidays, or market closure. The bar duration is always a multiple of the bar period. The time stamp associated to a bar is the current time at the end of the bar. When one bar ends, the next bar starts; there is no 'gap' between bars, even though the market may be closed during a bar or a part of it.
A time frame can cover several bars, and is normally used as a time basis for technical indicators and price series. For instance, TimeFrame = 4 merges 4 bars to a single time frame. Bars be be merged by any criteria and time frames can be synchronized to certain hours or other events. A strategy has one bar period, but can have multiple time frames. Indicators are normally based on the bar period, but can also be based on longer time frames or even on shorter periods by generating them in incoming price ticks.
Note that charts - by Zorro and by almost all other platforms - can be misleading about bar periods and indicators. A candle is usually printed centered at its bar time stamp (as in the chart above), not in front of it as would be correct. Indicators are usually printed with smooth lines, while they in reality have a discrete step at any candle. So the begin and end of bars and the crossings of indicators are normally slightly off in usual charts. For getting precise time and crossing points, don't stare on the chart with a magnifying glass, but check the backtest log.
Normally, any bar constitutes a candle that is generated from the price quotes during the bar. Since many assets are traded in sessions and have no or infrequent price quotes outside market time, out-of-session bars can be either merged to a single candle, or completely ignored. For merging them to a single bar, the time frame mechanism can be used. For ignoring price quotes outside a trading session, time series can be declared as static and individually shifted and filled.
Some traders believe that bars that cover not a fixed time period, but a fixed price movement, give them a better insight into the market. With a focus on price movement, long periods of consolidation are condensed into just a few bars, thus highlighting "real" price trends. There are many special bar types: Tick Bars, Renko Bars, Range Bars, Momentum Bars, Point-and-Figure Bars, or Haiken Ashi Bars. Some market inefficiencies may be more clearly visible when getting rid of speed and time information. Zorro allows any imaginable combination of price and time for constructing user-defined bars with the bar function.
Strategy development involves testing the strategy with historical price data. The prices are read from files in Zorro's History folder. For keeping the files at a reasonable size, they normally do not contain all the price quotes, but only one-minute candles (M1 data) or daily candles (D1 data). Files containing no cancles, but direct price quotes (T1 data), can also be used for special purposes, like testing scalping or HFT strategies.
Historical M1 data for main currencies, indices, and commodities is available on the Zorro Download Page. Data that is not found there can be downloaded (usually free) from brokers or from Internet data providers (Google™, Quandl™, etc.). Data in high resolution or with special content - for instance, option chains - is normally not free. It can be purchased from data vendors. There are vendors that specialize on certain data types or exchanges - for instance, iVolatility™ on options and futures, Nanotick™ on Chicago traded assets, or Nanex™ on New York traded assets. You'll get your data in a special format, usually CSV, that you can convert to Zorro's historical data formats using the dataParse function with a special format string. Examples for conversion scripts can be found in the Strategy folder.
Bars, candles, ticks, or quotes are often confused, and the meanings of those terms can also vary from platform to platform. Throughout this manual the following terms are used:
Asset - the traded product. Multiple synonyms are used in the trading literature, such as Instrument, Ticker, Issue, Market, or Security.
Quote - online offer by a market participant to sell or buy an asset at a certain price. The most recent price quote is the current bid or ask price of an asset. Other methods to define the current price, for instance the best recent quote or the last traded price, are rarely used.
Tick - a price with a time stamp. In live trading, a tick is generated by an incoming new price quote. In historical data files, a tick is a price sample with its associated time. If a tick is sampled together from several quotes, as normally in data files, its time stamp corresponds to its most recent quote.
Candle - price info covering a time interval with an open, close, high, and low price. T1 data contains only a single price quote per tick, so its open, close, high and low is the same price. Price ticks in historical files are usually candles with the first, last, highest, and lowest price of all quotes they are sampled from.
Bar - basic time interval; determines the width of a chart candle, the time resolution of the price curve, and the execution interval of a trading strategy. The time scale on a chart is divided into bars that cover at least one tick, but normally many ticks. The bar time interval can vary when special bar types, such as price-movement bars, are used. Time periods without ticks - such as weekends - are usually skipped on the chart time scale.
Time frame - basic time unit of algorithms and indicators in a trading strategy. It is often identical to a bar, but can also cover multiple bars in multi-timeframe strategies. A time frame can be synchronized to a full hour, day, or week. In that case the number of bars of a time frame can vary,
► atest version online