MichelT

Emulating binary operations and several values in one variable

Binary operations and storing several numbers in one variable.

It's useful when you need to pass a values numbers to another study. Study-on-study (SOS) in Tradingview allows passing only one value, which is not always convinient. So if we put all those numbers in one - we can pass more values from one study to another.

In Pine we can use up to 52 bits for our data. Because of that we can put 6 1-byte (8-bit) values in one float. Or 12 4-bit values. Or 52 1-bit values.

Von Favorisierten Skripten entfernen Zu Favorisierten Skripten hinzufügen

Kommentare

Another great and useful piece of code. Thx Michel.
+3 Antworten
@LucF, Thanks, Luc.
Antworten
... and don't forget the single var return from security :)
+2 Antworten
MichelT michl
@michl, Oh, yes. But as far I know, it won't be a problem soon - security will be allowed to return a tuple.
+3 Antworten
bravo, ingenious
+1 Antworten
This is great, thank you!
Antworten
May I call you "sensei"? Brilliant
Antworten
Daveatt Daveatt
@Daveatt, what could be the use cases for such a script?
Apart from passing output signals for buy/sell/close buy/close sell signals

Curious to know what are the general use cases you have in mind?
Antworten
MichelT Daveatt
@Daveatt, the only I can thik of are passing values to another script and returning more values from the security function. Few times I met cases when people used too much variables in their scripts, so the scripts couldn't be compiled, because of restriction on amount of the variables. It might (franckly, I doubt, but it might) be a workaround for the restriction - putting together several variables to make a script working.
+1 Antworten
MichelT Daveatt
@Daveatt, You are welcome, Daveatt!
+1 Antworten
Startseite Aktien-Screener Forex-Screener Krypto-Screener Wirtschaftskalender So funktioniert es! Chartmerkmale Preise Einen Freund empfehlen Hausregeln Hilfe Center Webseite & Brokerlösungen Widgets Charting Lösungen Lightweight Charting Library Blog & News Twitter
Profil Profileinstellungen Konto und Abrechnung Einen Freund empfehlen Meine Support Tickets Hilfe Center Veröffentlichte Ideen Followers Ich folge Private Nachrichten Chat Abmelden