In specific circumstances, it is possible to extract data, far above the 40 `request.*()` call limit for 1 single script . The following technique uses composite tickers. Changing tickers needs to be done in the code itself as will be explained further.
This will give the close value from 1 ticker (MTLUSDT); c1 for example is 1.153
Now let's add 2 tickers to MTLUSDT; XMRUSDT and ORNUSDT with, for example, values of 1.153 (I), 143.4 (II) and 0.8242 (III) respectively.
Just adding them up 'MTLUSDT+XMRUSDT+ORNUSDT' would give 145.3772 as a result, which is not something we can use...
Let's multiply ORNUSDT by 100 -> 14340 and multiply MTLUSDT by 1000000000 -> 1153000000 (from now, 10e8 will be used instead of 1000000000) Then we make the sum.
When we put this in a security call (just the close value) we get:
1153014330.8242 / 10e8 = 1.1530143408242 -> round -> in this case to 1.153 (I), multiply again by 10e8 -> 1153000000.00 (b) We subtract this from the initial number:
In this publication the function compose_3_() will make a composite ticker of 3 tickers, and the split_3_() function will split these 3 tickers again after passing 1 request.security() call.
You need to figure out how much you need to multiply each ticker, and the number for rounding, to get a good result.
In this case: 'BINANCE:MTLUSDT', multiply number = 10e8, round number is 3 (example value 1.153) 'BINANCE:XMRUSDT', multiply number = 10e1, round number is 1 (example value 143.4) 'BINANCE:ORNUSDT', NO multiply number, round number is 4 (example value 0.8242)
The value with most digits after the decimal point by preference is placed to the right side (ORNUSDT)
If you want to change these 3, how would you do so?
First pick your tickers and look for the round values, for example: 'MATICUSDT', example value = 0.5876 -> round -> 4 'LTCUSDT' , example value = 77.47 -> round -> 2 'ARBUSDT' , example value = 1.0231 -> round -> 4
Value with most digits after the decimal point -> MATIC or ARB, let's pick ARB to go on the right side, LTC at the left of ARB, and MATIC at the most left side. -> 'MATICUSDT', LTCUSDT', ARBUSDT'
Then check with how much 'LTCUSDT' and 'MATICUSDT' needs to be multiplied to get this: 5876 0 7747 0 1.0231
DO NOT change anything at t46, n46,... if you don't know what you're doing!
Only • tickers ('BINANCE:MTLUSDT', 'BINANCE:XMRUSDT', 'BINANCE:ORNUSDT', ...), • multiply numbers (10e8, 10e1, ...) and • round numbers (3, 1, 4, ...) should be changed.
There you go!
🔶 LIMITATIONS
🔹 The composite ticker fails when 1 of the 3 isn't in market in the weekend, while the other 2 are. That is the reason all tickers are crypto. I think it is possible to combine stock,... tickers, but they have to share the same market hours.
🔹 The number cannot be as large as you want, the limit lays around 15-16 digits. This means when you have for example 123, 45.67 and 0.000000000089, you'll get issues when composing to this: -> 123045670.000000000089 (21 digits)
Make sure the numbers are close to each other as possible, with 1 zero (or 2) in between: -> 1.230045670089 (13 digits by doing -> (123 * 10e-3) + (45.67 * 10e-7) + 0.000000000089)
🔹 This script contains examples of calculated values, % change, SMA, RMA and RSI. These values need to be calculated from HTF close data at current TF (timeframe). This gives challenges. For example the SMA / %change is not a problem (same values at 1h TF from Daily data). RMA, RSI is not so easy though...
Daily values are rather similar on a 2-3h TF, but 1h TF and lower is quite different.
At the moment I haven't figured out why, if someone has an idea, don't hesitate to share. The main goal of this publication is 'composite tickers ~ request.security()' though.
🔹 When a ticker value changes substantially (x10, x100), the multiply number needs to be adjusted accordingly.
🔶 SETTINGS
SHOW SETS
SET • Length: length of SMA, RMA and RSI • HTF: Higher TimeFrame (default Daily)
TABLE • Size table: \ _ Self-explanatory • Include exchange name: / • Sort: If exchange names are shown, the exchanges will be sorted first
COLOURS • CH% • RSI • SMA (RMA)
DEBUG
Remember t46, T16,... ? This can be used for debugging/checking ALWAYS DISABLE "sort" when doing so.
Example:
Set string -> T1 (tickers FIL, CAKE, SOL) (Numbers are slightly different due to time passing by between screen captures)
Placing your tickers at the side panel makes it easy to compare with the printed label below the table (right side, 332201415014.45), together with the line T1 in the script:
Now it is easy to check whether the tickers are placed close enough to each other, with 1-2 zero's in between.
If you want to check a specific ticker, use "Show Ticker", see out initial example: Set string -> T16Show ticker -> 46 (in the code -> t46 = 'BINANCE:MTLUSDT')
(Set at 0 to disable "check string" and NONE to disable "Set string")
-> Debug/check/set away! 😀
🔶 OTHER TECHNIQUES
• REGEX (Regular expression) and str.match() is used to delete the exchange name from the ticker, in other words, everything before ":" is deleted by following regex:
ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.
- We cannot control our emotions,
but we can control our keyboard -
גם על:
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.