BinaryDecimalConversion

Converts decimal to and from binary.
to_binary(number) convert integer to binary string
Parameters:
- number: int, value to convert.
Returns: string
to_decimal(binary) Converts a binary in a string to decimal.
Parameters:
- binary: string, binary number in a string.
Returns: int
Added:
leftshift_logical(x, n)
Shift the bits of an integer to the left.
Parameters:
x: int . Value to shift.
n: int . Number of zeros to append to x.
Returns: int.
Added:
rightshift_logical(x, n)
Shift the bits of an integer to the right.
Parameters:
x: int . Value to shift.
n: int . Number of bits to remove at the right of x.
Returns: int.
leftshift_arithmetic(x, n)
Shift the bits of an integer to the left.
Parameters:
x: int . Value to shift.
n: int . Number of zeros to append to x.
Returns: int.
leftshift_arithmetic () {
reference:
stackoverflow.com/questions/5832982/how-to-get-the-logical-right-binary-shift-in-python
rightshift_arithmetic(x, n)
Shift the bits of an integer to the right.
Parameters:
x: int . Value to shift.
n: int . Number of bits to remove at the right of x.
Returns: int.
Updated:
leftshift_arithmetic(x, n)
Shift the bits of an integer to the left.
Parameters:
x: int . Value to shift.
n: int . Number of zeros to append to x.
Returns: int.
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.