# Crosses Comparisons and Indicator Calculations

In this document we will clarify how indicators are calculated in Metatrader 4, why it is important to use the fixed values for indicators.

# Definition of ‘Crossing’

In its simplest form, ‘crosses’, both ‘crosses from above to below’ and the opposite, ‘crosses from below to above’ is the change over time of one variable compared to another.

To illustrate this, see the diagram below. Time is T.

Previously, at T-1 the blue variable is greater than the red. Time moves on to T 0, where the red variable is greater than the blue.

This in this scenario both the following are true:

• Blue crosses from above to below red.
• Red crosses from below to above blue.

Figure 1

When using a crosses comparison in trade the trader needs to be aware that calculated based on a single value of the timeframe.

## Time frames

Charts in a trading platform display aggregations of price changes. These aggregations are known as Bars. A bar shows aggregated values of the minimum, maximum, first and the last values - commonly known as Open, High, Low and Close (OHLC).

# Calculating Technical Indicators

The settings of individual Technical indicators included the Applied Price. These included the following:

• OPEN
• HIGH
• LOW
• CLOSE
• MEDIAN
• TYPICAL
• WEIGHTED

In some trading platforms, such as Metatrader 4, indicators are displayed both with fixed values, and importantly, the latest value for the indicator is calculated every tick, until the bar is closed. The exception to this is when an indicator is set to calculate on the OPEN, in which case there is no need to continually recalculate the indicator on each time.

Therefore, indicators, other than those that are set to calculate on OPEN, will be repainted on the chart, and the latest value of the indicator will update, until the bar has completed.

To illustrate this, see Figure 2, which shows a 1 Hour chart. Here we see that, 13:30 an Indicator (shown in blue) has crossed from below to above a horizontal line.

Figure 2

Then later, at 13:50, as shown in Figure 3, the indicator is shown, updated, and now it is no longer crossing. This is because the calculations are updated on tick, but the final indicator value has yet to be set, as the bar is not yet complete.

Figure 3

# Fixed Values

Tradeworks uses the fixed values of indicators. To use Figure 3 as an example, Tradeworks will only use the fixed values that are in T-2 and T-1, as T-0 has not yet completed, and the values of the indicator at T-0 are not certain. When calculating the indicator on OPEN values then all Entry and Exit rules created in Tradeworks will run on the previous time frame (or up to 20 bars back if you desire).

## Auditing

By using the fixed indicator values, traders are able to see the historical values on their trading platform charts and compare those the outcome of their Tradeworks strategy.

We found that to use the immediate value of indicators, that is, as the are updated after each tick lead to many ‘false positives’. Strategies would trade, but when comparing results to charts, it was not easy to explain why it traded. It can also lead to a lot more trades than expected as a cross can occur many times during a timeframe.

## Shift

Many technical indicators, such as Bollinger Bands and Moving Averages, have a Shift parameter. This value allows the indicator to be moved forward (for example, when the value is 5), or backward (for example, when the value is -5) on the chart based on Shift value. This can help compensate for the use of fixed indicator values.

In Tradeworks this is disabled because a negative shift logically makes little sense as we don't know the future value of the indicator, and secondly, because a positive shift is equal to looking at a historic indicator value which is easily done in the Entry and Exit rule design. Another benefit is that you dont have to create multiple indicators eg. with shift = 1, shift = 2, shift = 3. Just create one indicator and set the "shift" inside the Entry and Exit rule.