midtownsk8rguy

PSv4.0 Limited Array Support Super Hack

2473 просмотров
107
This is my "PSv4.0 Limited Array Support Super Hack", derived from MichelT's Workaround for Arrays in pine and Bubble sort script, except this utilizes line.new() to obtain one array with up to 100 indices. I provided functions that may be syntactically comparable in operation to the array class we should get with PSv5.0 when that arrives. I have no clue when that ETA shall be either, so your guess is as good as mine. Due to the complexity of the script, I would ONLY recommend this script's functions for reuse by advanced Pine programmers, not newcomers to Pine Script.

Notice: FYI, support for these functions will be limited to only errata with the included functions. Honestly, I don't have an abundance of time on a daily basis to assist members with incorporation into their newly developed scripts. I hope you will understand.

The intention of this script is to provide Pine developers with one large array having up to 100 indices until we have full native array support in the future. Availability of full use of the array is only obtained when bar_index is indicesCount-1, so bear that in mind. This script is so computationally expensive, I would only advise using it "as is" on 5Y and All Charts at it's current initial release. On smaller sampling rates such as 1D, 5D and 1M... it has a tendency to encounter runtime errors such as this message: "Calculation timed out. Remove the indicator and reapply it to the chart". I just switch to a larger sampling interval - 5Y or All. I believe this is occurring due mostly to prng() generating thousands of random floating point numbers, PLUS the overhead of using line.new() for something it wasn't originally intended for. It does also use 64 plots in full color, maxing out the plotting capabilities of Pine as well. With usage of the array functions alone in your code, I anticipate those scripts to be more server friendly.

Basically this scripts functionality, as is, generates 32 pseudorandom numbers per bar in a sky blue birds nest of random numbers. It then sorts them numerically and plots them once again in a visually stunning rainbow spectrum. You will notice the plot()s colors will invert when the sorting order is changed in Settings. I commented out a lot of plot()s because we are limited to a maximum of 64 plot()s. By commenting and uncommenting with highlighted text blocks and + , you may alter the scripts appearance when done properly.

Overall, I hope you find it useful with incorporating expected array functionality that will perpetuate the novel development of next generation indicators in Pine Script version 4.0 . Once again, check out MichelT's brilliantly crafted script mentioned above. You may be able to use both scripts incorporated into an all-in-one to have dual array support, BUT I have not tested this yet, be forewarned. I hope the community contribution of this script in open source is of some benefit to those who can utilize it properly. As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette", so this script is more than just a complex array provision...

The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Комментарии

Brother, I understand this is not an indicator. But after playing around with this on a daily chart for some crypto and stocks, I must say that more times than not, an inversion or disruption of the lines precipitates a major move in one direction or another. The only problem there doesn't seem to be a rhyme or reason to which way the move occurs when the lines point down or up all at once. Sometimes they point up and the price explodes down, sometimes it explodes up. And vice versa. My point to this reply, is that I am using this as an early warning of sorts for a movement on daily charts. I will get back to you on how it works live. But you've created something very interesting here which deserves to be tested. Thank you!
Ответить
midtownsk8rguy MichaelMMM
@MichaelMMM, "But, as you well know, appearances can be deceiving Mr. Anderson" :) This is not an indicator for trading purposes, definitely. It was only a way to provide array functionality without native array support in Pine, like what we do have now: https://www.tradingview.com/pine-script-reference/v4/#fun_array{dot}new_float Basically, it just produces random numbers and sorts them, nothing more intended OR should be expected at all from this code. The only real value this code may contain now, is just the rainbow gradient colors.

While there may be "coincidental alignments" at this current time, expect those to disappear eventually when you least expect it financially! I would rather use an astrologer employing tasseography, reading tea leaves, than ever use this script for trading decisions. I wouldn't suggest prophetic oracles shouldn't be used for trading decisions either. Thank you for your appreciation, but I just wanted to express that it may only have the appearance of being coincidental. Here is an intriguing primer on optical illusions: http://www.mesasoftware.com/optical_illusions.htm

I'll let you in on a fascinating tidbit... Our brains "interpret" electrical signals from our eye's sensory cone cells, through the optical nerve super highway straight to brain's core, providing us an approximate 400 billion DPI visual resolution at about 24 frames per second. The tiny sliver of the universe, as it appears to exist to us visually, is actually "reconstructed" inside our mind with staggering geometrical precision with an astounding amount of bio-electrochemical quantum computation. Still there is a limit of precision, hence our visual margin of error in our mental construct. If we could really see the cosmos as it truly exists, we would only see astronomical amounts of encoded numbers everywhere mathematically expressing in the form of interacting energy and matter. I once saw AtomsInVisibleUniverse=pow(10, 80), and that excludes AmountsOfUniversalEnergy.
Ответить
you rock!
Ответить
WOW
Ответить
Amazing! It's really cool!
Ответить
dabbling with sorting for a while and could not get it to work. How do we sort six floats in an ascending order ? thanks
Ответить
midtownsk8rguy ozanyurdakul
@ozanyurdakul, Good things come to those who wait patiently... Your aspirations of easily sorting 6 floats, will be unveiled in due time. It may take the likely form of array.sort(ArrayOfSixFloats)
Ответить
ozanyurdakul midtownsk8rguy
@midtownsk8rguy, thank you for your support ...I feel graditude ...
Ответить
Thank you @midtownsk8rguy !
Ответить