[#!: full-line executeEmbeds, phraseValueList = (("fout fout)("backtrack backtrack))
[#!: path_insertIn_fHand (link d_webWork 'fin Head_one.html') fout ;
Howell - TradingView PineScript of SPX500USD [Puetz time, Fibonacci price] multiFractals
[#!: path_insertIn_fHand (link d_webWork 'fin Head_two.html') fout ;
[#!: path_executeEmbedsInsertIn_fHand (link d_webWork 'Menu.html') phraseValueList ;
[#!: path_executeEmbedsInsertIn_fHand (link d_webWork 'Menu projects.html') phraseValueList ;
[#!: path_insertIn_fHand (link d_webWork 'normalStatus.html' ) fout ;
Howell - TradingView PineScript [description, problem, debug].html
"... True power only emerges with multi-fractals, when time is one of the fractal dimensions. ..."
"... Is software programming like blacksmithing a Japanese sword?
Round and round again, with blemishes helping to illuminate your failures of [focus, technique, thinking]. ..."
Table of Contents
-
TradingView, PineScript - general description
-
WARNINGS! Pine Script coding
Related background information on my other webPages : see [general, specific] links to [concepts, my software, data, results, etc] in :
PineScript examples written by others :
TradingView, PineScript - general description
TradingView is an excellent financial market [chart, trade]ing platform, that updates prices on a near-real-time basis. Free access is available to some of the platforms features, and user may upgrade according to a subscription plan that suits them. All [investor, trader]s have become used to this kind of capability, of course, and it is a huge advantage to have some [concept, theory, tool, practice] available for [view, use] in a dynamic environment.
PineScript is the proprietary charting language that is integrated into TradingView. It is well-suited to the platform, but it is a very specialised and quirky language to get used to. I'm not sure - it may be related t"... TypeScript is a language for application-scale JavaScript development. It's a typed superset of JavaScript that compiles to plain JavaScript. ...".
WARNINGS! Pine Script coding
Pine Script is a wonderful tool, but its a very different language from most, and the "hidden syntax imperatives" can kill you and waste days of your time. Furthermore, while compiler messages are very helpful, they are far from complete, and oftn the code compiles ("Save") well, but nothing happens, leaving you in the dark. If you are doing heavy programing, Pine Script won't work, but then you won't have the TradingView almost-real-time data updates.
There is a great deal of "leftover code" from very differenty approaches to doing [time, price] fractals.
I reverted to an older multi-series approach for plotting priceFractals.
Still have a problem with "scrunching" of [1,5] year graphs, but not of [ALL, <1 year] graphs
I'm happy with Pinecript for what it does do.
TradingView is highly constrained by legal, business] requirements, and that's fair :
- data security, so it's not all freely available which would like violate supplier contracts
- spam, malicious users, the plague of everything since before the dawn of history
- costs of users' inefficient code, as everything is tun on their servers
- TradingView handles the horrible challenge of tracking market open [day, hour] worldwide
just doing that for one symbol on one market would be a pain
Key frustrations I've had, as part of the learning process :
- PineScript can be strangely difficult to get working, as it isn't easy to understand how
Pine Script works when you don't read the manuals. (really, read the manual? you're kidding me!)
- poor [consistency, clarity] in stating series indexing :
eg : last_bar_index - Bar index of the last chart bar. Bar indices begin at zero on the first bar.
While this seems clear, is index [0] the earliest or latest time on the chart?
I've been messed up from many past efforts to get code working.
PineScript needs to fix descriptions!
- failed basic concepts : arrays are NOT series, but series are NOT typed or properly defined
very sloppy usage
- not good for modular [code, test]ing. It's big thing to [setup, save, run] side programs
- my code is often unstable - the chart changes for seemingly [irrelevant, minor] code changes
I suspect this is due to my limited understanding (still, after a couple of years) of how it works
- plot cannot be used locally in [function, if, for, etc]. This is hugely limiting to code efficiency
- [tab, space]s will kill you - especially the [if, for] statements!!
- sequences are NOT arrays, and I still trip over this and waste a lot of programming time
there are many ways around this, but they are [problematic, partial], rarely satisfying the need
- [=, :=] and variable declarations are critical
- [barstate.is[first, last] takes getting used to - "first" is actually the last time bar
- many error messages are cryptic (like every other programming language)
- keep a file with key problems you've encountered, as they will come back
- [line, label, bax].new and many other functions require time SERIES [bars,UnixTime]
I've simply used the "cost" series (seems hugely wasteful of computation time!?)
- debugging sucks!! This is the most serious problem of all??
- the [line, label, etc].new functions are horible, always fails (series type required.
- Idiocy not to have a simple text output on the chart!!!!
Key worries that trip me up :
- PineScript is INSANELY inefficient for simple things
it forces you to [use, calc] series of thousands of items, when you only want a simple constant!
- while TradingView charts easily allow you to "lock items on a chart" (fix at one position)
I still haven't found that in PineScript
for more comments on errors, see :
"$d_webRawe"'Software programming & code/PineScript for TradingView market charts/0_PineScript errors.txt'
STUPID ME!!! (ouch)
As per the example code lines below, I was using a series for the 1926-2020 fractalPrices.
But it's FAR more [efficient, fast] to simply plot lines!!
This also gets around the "can't use plot locally" challenge, and is what I did for fractal Time.
Man, am I slow. ARGGGHHH!
- plot(priceMin < priceBase and priceBase < priceMax ? priceBase : na, title="priceBase", color=color.navy, linewidth=3)
- priceBaseLabel = Fib_label(priceMin < priceBase and priceBase < priceMax ? priceBase : na, " 0.000")
20May2022 This coding is really messed up, I reverted to an older version given problems as listed above.
"spikes" (vertical lines) for timeFractals are positioned wrong and intermittent
fractalPrices are "squeezed up" for the [1Y, All] timescales
My [frequent, ongoing] failures with PineScript programming
I still don't understand many of the PineScript idiosyncracies. It has taken me weeks to "sort-of" solve a problem but even a year or two to gain enough knowledge to develop better approaches.
Here are some PineScript coding [bugs, issues], mostly based on my own ignorance of how to use the language :
- [quirky, invisible] : a series-type variable used in a function returns the current value,ot a [series, array]. This is very confusing when learning to program in PineCode.
- array.new_float works, array.new<float> as specified in manual, does NOT
- PineScript coding is NOT stable!!!
- results aren't consistent even when I repeat the same thing with no code changes!
- I suspect this might be because I am not properly forcing variables to be constants
- very frustrating, as this is NOT a problem with other languages...
- 23May2022 Standard time-views "1Y" and "5Y" show a "compacted, scrunched" SP500USD that spans only a fraction of the chart. A bug fix will have to wait for a few months. (14Jun2022 - often this is caused by "n_bars" (span of graph in bars) being too large. Sometimes dragging the chart middle to the right,expand the timescale revels ming information and expands the line being observered.
- ary_n_bar -> can cause scrunching of outputs!!!
- 27May2022 PineScript provides no bug-free means of getting [start time of chart, duration of chart [n_bars, Unix time]. This is ridiculous!
- I did it by trial & error for each time period and even then...it isn't so good
- I always use the same window size, and expect that n_bars eall change for different windows
if the window size matters, it might be possible to put that into a formula
- time_label(timer, serPrice, priceOffset, txt) => couldn't get to work
- could not get line.new to word
- nested [for, if] expressions only seem to work for a couple of levels
- declaring with, for example, "int" or "var int" somtimes wont work?
- perhaps this has to do with how "global" and "local" are handled, but I've found it to be a quagmire.
-
-
- "If all else fails, try reading the manuals" - not yet, that's a last resort <grin>. I use the manual all of the time, but sometimes solutions are buriedd eep in an example or some remote part of the manual.Most often problems are solved via none-PineScript blogs (that is normal with programming).
19May2022 initial posting
28May2022 comments about SPX500USD chart (before Fibnacci priceFractals nexted)
[#!: full-line executeEmbeds, phraseValueList = (("fout fout)("backtrack backtrack))
[#!: path_executeEmbedsInsertIn_fHand (link d_webWork 'fin Footer.html') phraseValueList ;