# Technical Studies Reference

This study calculates butterfly spreads of corresponding variables of three charts. Refer to the Multiple Chart Studies description for instructions to use this study.

Let $$X_t^{(1)}$$, $$X_t^{(2)}$$, and $$X_t^{(3)}$$ denote the value of any chart variable (listed below) at Index $$t$$ of Chart 1, Chart 2, and Chart 3, respectively. Chart 1 (aka the Source Chart) is always the chart to which the Sum (Bar) study is applied, and Charts 2 and 3 (aka the Destination Charts) are the charts specified by the Chart 2 Number and Chart 3 Number Inputs, respectively. $$X_t^{(1)}$$, $$X_t^{(2)}$$, and $$X_t^{(3)}$$ can represent any of the following variables.

• Open
• High
• Low
• Last
• Volume
• Number of Trades / Open Interest
• OHLC Avg
• HLC Avg
• HL Avg

Let $$v_1$$, $$v_2$$, and $$v_3$$ denote the Inputs Chart 1 Multiplier, Chart 2 Multiplier, and Chart 3 Multiplier respectively. Then the Spread - Butterfly study calculates the following spreads.

$$\displaystyle{v_1 \cdot X_t^{(1)} - v_2 \cdot X_t^{(2)} + v_3 \cdot X_t^{(3)}}$$

The spreads are displayed only for Open, High, Low, and Close. These are displayed in the form of OHLC Bars by default, and the price graph draw type can be changed through the Graph Draw Type setting in the Study Settings window for the study.

When corresponding bars in the three charts do not match in both date and time, then this study uses the sc.GetNearestMatchForDateTimeIndex() to find a match.

If the Use Latest Source Data For Last Bar Input is set to Yes, and a replay is not running and at the last bar in the Destination Chart, then the study uses the data from the very latest bar in the Source Chart. If this Input is set to No, then this is not done.

#### Inputs

• Use Latest Source Data For Last Bar: Determines whether the data from the last bar in the Source Chart is to be used.
• Chart 2 Number: Determines which chart is to be used in the second terms of the calculated spreads.
• Chart 3 Number: Determines which chart is to be used in the third terms of the calculated spreads.
• Chart 1 Multiplier
• Chart 2 Multiplier
• Chart 3 Multiplier