RicardoSantos

Function: Complex Numbers

A set of functions to handle complex numbers.

from https://en.wikipedia.org/wiki/Complex_number:
A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers, and i represents the imaginary unit, satisfying the equation i2 = −1. Because no real number satisfies this equation, i is called an imaginary number.
Release Notes: added a few extra functions, based on the js library:
//https://github.com/trekhleb/javascript-algorithms/blob/477f30b0bdac6024874d2976de1eca7afe0176dd/src/algorithms/math/complex-number/ComplexNumber.js#L3
Release Notes: added better formatting and comments on all functions, work in progress(complex arrays UDF)
Release Notes: corrected some issues added more comments
Release Notes: added "complex_set" functions for complex numbers, streamlined calls to use it, improving readability..
Release Notes: added: f_complex_equals(), f_complex_ceil().
improved comments.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?