## Phase Calculation

Phase Calculation was authored by John F. Elders in the Stocks and Commodities Magazine 11/1996. Phase Calculation manipulates the price over a period with complex number information but, real or imaginary, degree by degree, the final phase is found. The user may change the input (close) and period length. This indicator’s definition is further expressed in the condensed code given in the calculation below.

### How To Trade Using Phase Calculation

Phase Calculation may be used in conjunction with other indicators. No trading signals are given.

### How To Access in MotiveWave

Go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.

### Calculation

//input = price, user defined, default is close
//period = user defined, default is 15
//sin = sine, cos = cosine, tan = tangent
//abs = absolute value, asin = arc sine, atan = arc tangent
//imagP = imaginary part, realP = real part
//index =current bar number, LOE = less or equal

```weight = 0;
realP = 0;
imagP = 0;
j = 0;
phase = 0;
for i = index - period + 1; i LOE index; i++)
weight = price[i];
radians = toRadians(360 * j / period);
realP = realP + cos(radians) * weight;
imagP = imagP + sin(radians) * weight;
j++;
endFor
if (abs(realP) moreThan .001) phase = toDegrees(atan(imagP/realP));
else phase = 90 * toDegrees(asin(imagP));
if (realP lessThan 0) phase = phase + 180;
phase = phase + 90;
if (phase lessThan 0) phase = phase + 360;
if (phase moreThan 360) phase = phase - 360;
Plot: phase;```