#] #] ********************* #] "$d_PineScript"'1_PineScript errors.txt' www.BillHowell.ca 19May2022 initial 18Mar2021 PineScript's own code doesn't work!! - they must be still fixing bugs from an upgrade Jul2020? 24************************24 23May2022 NO MORE PINESCRIPT PROGRAMMING!!!!! iT WASTES HUGE AMOUNTS OF MY TIME!!! >> 23May2022 I'm a Crybaby, actually the old priceFrac code works nicely, even if it doesn't nest. 24************************24 # Table of Contents, generated by : # $ grep "^#]" "$d_PineScript"'1_PineScript errors.txt' | sed 's/^#\]/ /' ********************* "$d_webRawe"'Software programming & code/PineScript for TradingView market charts/1_PineScript errors.txt' 11Jun2022 var keyword - causes problems normally, reverts to initial state! 09Jun2022 can PineScript write to file? NO? 09Jun2022 note that the [plot, hline] functions cannot be a local : ie in [function, for, if, etc] 09Jun2022 How to fix “Value with NA type cannot be assigned" 04Jun2022 Cannot properly specify simple [int, float] args!!??!!, errors : An argument of 'series float' type was used but a 'simple float' is expected; An argument of 'series int' type was used but a 'simple int' is expected 01Jun2022 Cannot call 'barLast_label' with 'na' as a value for a non-typified argument. The argument 'price' should be explicitly typified. 23May2022 line.new error : Bar index value of the 'x1' argument (2160.000000) is too far from the current bar index.. Try using 'time' instead. 23May2022 Return type of one of the 'if' or 'switch' blocks is not compatible with return type of other block(s) (series string; void) 23May2022 Syntax error at input 'i_zone' : I had 3 spaces instead of tab in for loop 23May2022 Return type of one of the 'if' or 'switch' blocks is not compatible with return type of other 23May2022 step_nums don't work in for statements : don't use!! 23May2022 barstate.islast - label.new has to go to last bar (cannot array index) ??May2022 Cannot modify global variable 'multiplier' in function. 22May2022 DO NOT specify "by" in for statements : for i_level = 0 to (n_ary_fracLevel - 1) by +1 ??May2022 Cannot use 'plot' in local scope. ARGHHH!!! I forgot about that!! 19May2022 Mismatched input 'if' expecting 'end of line without line continuation' don't put comments in code!!! 19May2022 How do you change the symbol or ticker on a chart? 19May2022 was declared with 'float[]' type. Cannot assign it expression of type 'series float' 19May2022 Input box settings - how I access? (I can't find it to save my life) 19May2022 Unassigned argument size; 19May2022 Mismatched input 'if' expecting 'end of line without line continuation'. 19May2022 couldn't find input tabs, so normal Pine Script user-adjustments unavailable 17May2022 ary_n_bar -> can cause scrunching of outputs!!! 15May2022 inputs tab - cannot find anywhere for user setting of constants etc 11May2022 Proj-mini 'Howell - SP500 with 83 year Fibonacci trend, PineScript.txt' 09May2022 Syntax error at input 'i_priceFrac'. : [if, for] statements 17Mar2021 search "TradingView PineScript and Mismatched input 'for' expecting 'end of line continuation'." 17Mar2021 search "TradingView PineScript and "cannot call 'array.get' ..." 24************************24 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] ??Jun2022 08******08 #] 11Jun2022 var keyword - causes problems normally, reverts to initial state! https://www.tradingview.com/pine-script-reference/#op_var var is the keyword used for assigning and one-time initializing of the variable. Normally, a syntax of assignment of variables, which doesn’t include the keyword var, results in the value of the variable being overwritten with every update of the data. Contrary to that, when assigning variables with the keyword var, they can “keep the state” despite the data updating, only changing it when conditions within if-expressions are met. 08******08 #] 09Jun2022 can PineScript write to file? NO? apparently not - I couldn't find anything maybe makes sense, that would violate web security 08******08 #] 09Jun2022 note that the [plot, hline] functions cannot be a local : ie in [function, for, if, etc] must use line.new 08******08 #] 09Jun2022 How to fix “Value with NA type cannot be assigned" https://quantnomad.com/faq-value-with-na-type-cannot-be-assigned-to-a-variable-that-was-defined-without-type-keyword-how-to-fix/ How to fix “Value with NA type cannot be assigned to a variable that was defined without type keyword.” +-----+ #] 04Jun2022 Cannot properly specify simple [int, float] args!!??!!, errors : #] An argument of 'series float' type was used but a 'simple float' is expected; #] An argument of 'series int' type was used but a 'simple int' is expected This WORKED! I went back to remove [int, float] specification function eg optr change : +.....+ barFirst_label(simple int n_bars, simple int barsShiftRight, float serPrice, simple float priceOffset, string txt) => +.....+ To : +.....+ barFirst_label(int n_bars, int barsShiftRight, float serPrice, float priceOffset, string txt) => +.....+ first, I tried to cast args to int(...), float(...) >> didn't work >> Darn, this code worked pfectly until I screwed around with the lbrary setup >> didn't do my backup! (again...), couldn't find a working version +-----+ #] 01Jun2022 Cannot call 'barLast_label' with 'na' as a value for a non-typified argument. #] The argument 'price' should be explicitly typified. https://stackoverflow.com/questions/68605464/what-is-the-meaning-of-the-function-na-in-pinescript If you read the documentation, you will find section "Preventing na values, functions na and nz" describing its purpose: In addition, there is a simple function with one argument that returns a logical result called na. This function makes it possible to check if the argument is na or not. Check it out here. The link is a description of the function: na Test value if it's a NaN. na(x) → bool na(x) → series[bool] Returns true if x is not a valid number (x is NaN), otherwise false. answered Jul 31, 2021 at 20:22 Andreas >> I just fed a default price value : barLast_label(bool2618Hi ? lin2618Hi : line0000, "+2.618") https://quantnomad.com/faq-value-with-na-type-cannot-be-assigned-to-a-variable-that-was-defined-without-type-keyword-how-to-fix/ +-----+ #] 23May2022 line.new error : Bar index value of the 'x1' argument (2160.000000) is too far from the #] current bar index.. Try using 'time' instead. >> this makes line.new seless!!!! My whole attempt to circumvent "plot cannot be local" fails on this!!! Frigging useless #] 23May2022 Return type of one of the 'if' or 'switch' blocks is not compatible with return type #] of other block(s) (series string; void) https://stackoverflow.com/questions/69726829/return-type-of-if-block-incompatibility-in-pinescript Return type of if block incompatibility in PineScript Asked 6 months ago Modified 6 months ago Viewed 170 times edited Oct 26, 2021 at 22:00 asked Oct 26, 2021 at 16:30 user avatar Edgar Brown 20311 silver badge8 After much tinkering, the problem is with the way Pine Script deals with variable types. For some reason the functions are not able to resolve the type of its arguments and are left "raw" as the IF block checks the type of its results. The solution that @rumpypumpydumpy posted works in this specific case, but the unevaluated functions propagate down the code causing further errors to be solved. What I found is something that I am not sure is documented in Pine-Script manuals (I haven't explicitly seen it used), but it makes sense from many a language's perspective. Change the declaration of the problematic functions to explicitly type their arguments like so: Cmul(float x1, float y1, float x2, float y2) => float x = x1*x2-y1*y2 float y = x1*y2+x2*y1 [x,y] This way, the type resolution code can figure out what is the type of the resulting variables should be, removing all conflicts in the IF block and further down the code. answered Oct 27, 2021 at 20:39 user avatar Edgar Brown 20311 silver badge88 bronze badges +-----+ #] 23May2022 Syntax error at input 'i_zone' : I had 3 spaces instead of tab in for loop #] 23May2022 Return type of one of the 'if' or 'switch' blocks is not compatible with return type of other block(s) (series string; void) #] 23May2022 step_nums don't work in for statements : don't use!! for i_level = 0 to (n_ary_fracLevel - 1) by +1 #] 23May2022 barstate.islast - label.new has to go to last bar (cannot array index) label.new(bar_index, close, text="priceBase[0] = noNumber provided", xloc=xloc.bar_index, textcolor=color.black, color=na, style=label.style_label_left, size=size.large) #] ??May2022 Cannot modify global variable 'multiplier' in function. drawPriceFracs() => for i_zone = (n_ary_fracZone - 1) to 0 by -1 multiplier := array.get(ary_fracZone, i_zone) priceFrac := priceBase * multiplier txt := "priceBase[0] = noNumber provided" label.new(bar_index, close, text="priceBase[0] = noNumber provided", xloc=xloc.bar_index, textcolor=color.black, color=na, style=label.style_label_left, size=size.large) >> Wow! how pathetic is this? Bring declaration in local +-----+ #] 22May2022 DO NOT specify "by" in for statements : for i_level = 0 to (n_ary_fracLevel - 1) by +1 doesn't work #] ??May2022 Cannot use 'plot' in local scope. ARGHHH!!! I forgot about that!! crappy programming language!!! This is STUPID +-----+ #] 19May2022 Mismatched input 'if' expecting 'end of line without line continuation' #] don't put comments in code!!! I had this problem before - must add se? https://stackoverflow.com/questions/70743055/i-got-tradingviews-end-of-line-without-continuation-error-with-pine-script-p When you want to have multi line statements, your next line should begin with one or several (different from multiple of 4) spaces. Source From what I can see from your screenshot, your lines start with multiples of 4 spaces on line 24 and 25. And this is why you shouldn't post your code as a screenshot. answered Jan 17 at 15:19, vitruvius https://quantnomad.com/faq-syntax-error-at-input-end-of-line-without-line-continuation-how-to-fix/ How to fix “syntax error at input ‘end of line without line continuation’.” in pine script FAQ, Pine / By QuantNomad Just adding 3 spaces as an indent will solve that problem for you: x = open > close ? 1 : open < close ? -1 : 0 https://kodify.net/tradingview/errors/mismatched-input/ Error example: commenting out an indented line With TradingView’s comments (// ...) we can add notes to our script and add some structure. With them we can also temporarily disable a portion of code. But sometimes when we comment out a line of code, TradingView scrambles to understand our script. When it don’t get what we’re trying to do, it triggers the ‘mismatched input’ error instead. This happens because a line that’s commented out with // is effectively removed from our code. And that can effect how TradingView interprets the lines after it. BNUTS!! I was missing an argument : from fracLine := ratio_to_frac(priceFrac0 * fibber) to fracLine := ratio_to_frac(priceFrac0 * fibber,) Another darned - cut up line I should have seen : from : fibLabel(i_priceFrac = priceFrac_label(fracLine(0), str.tostring(fibber)) to : priceFrac_label(2000, str.tostring(fibber)) +-----+ #] 19May2022 How do you change the symbol or ticker on a chart? https://www.tradingview.com/support/solutions/43000543012-how-do-you-change-the-symbol-or-ticker-on-a-chart/ How do you change the symbol or ticker on a chart? To change the symbol or ticker, type the name asset you're looking for directly into your keyboard. A search box will appear and you can select the symbol you want. >> I wish I knew this 2 years ago!!!! +-----+ #] 19May2022 was declared with 'float[]' type. Cannot assign it expression of type 'series float' series aren't arys!!! so the following attempt generated error : simple_label(100, priceFrac0, fracTyp) I wanted y position of priceFrac0 at barstate.isfirst +-----+ #] 19May2022 Input box settings - how I access? (I can't find it to save my life) Inputs can only be accessed when a script is running on the chart. Script users access them through the script’s “Settings” dialog box, which can be reached by either: Double-clicking on the name of an on-chart indicator Right-clicking on the script’s name and choosing the “Settings” item from the dropdown menu Choosing the “Settings” item from the “More” menu icon (three dots) that appears when one hovers over the indicator’s name on the chart >> this doesn't exist!! Double-clicking on the indicator’s name from the Data Window (fourth icon down to the right of the chart) >> None of the above settings icon, top right of chart, 3rd icon from right >> just the standard stuff Maybe my computer security will not allow popups?? I give up +-----+ #] 19May2022 Unassigned argument size; >> I forgot to include an ary size as an argument +-----+ #] 19May2022 Mismatched input 'if' expecting 'end of line without line continuation'. https://stackoverflow.com/questions/70382767/resolved-pine-script-mismatched-input-expecting-end-of-line-without-line-con >> example on webPage is that there was no statement on the next line >> in my case, put comment marker "//" at atart of line ,rather than inline with required positioning >> didn't help when I changed that I was missing the ending parenthesis : simple_label( 100, priceFrac0, str.tostring("Liebnitz fra not yet coded (far mre complex - Fractional Order Calculus")) nyet : var float priceFrac0 = array.new_float(calc_yTrend(n_bars)) var priceFrac0 = calc_yTrend(array.new_float(n_bars, 0.0)) var string fracTyp = array.new_string(9, "Fibonacci") line 38: Declared type string is not compatible with assigned type string[] >> Problem was that I mixed up arys and floats! >> STUPID ME!! +-----+ #] 19May2022 couldn't find input tabs, so normal Pine Script user-adjustments unavailable input.string : https://www.tradingcode.net/tradingview/pine-script-inputs/index.ccc548f771.html nyet : fracTyp = input.string(title="fracTyp", options= ["Fibonacci", "Liebnitz", "Puetz"]) ) nyet :string fracTyp = array.new_string(9, "Fibonacci") +-----+ #] 17May2022 ary_n_bar -> can cause scrunching of outputs!!! +-----+ #] 15May2022 inputs tab - cannot find anywhere for user setting of constants etc maybe : fracTyp = input.string(defval="Fibonacci", title="fracTyp", options= ["Fibonacci", "Liebnitz", "Puetz"]) #] 11May2022 Proj-mini 'Howell - SP500 with 83 year Fibonacci trend, PineScript.txt' "$d)webRawe"'Software programming & code/PineScript for TradingView market charts/Howell - SP500 with 83 year Fibonacci trend, PineScript.txt' +-----+ #] 09May2022 Syntax error at input 'i_priceFrac'. : [if, for] statements https://kodify.net/tradingview/errors/syntax-error-input/ How to fix the ‘syntax error at input’ error in TradingView Pine Scripts? A closer look at TradingView’s ‘syntax error at input’ error To successfully write TradingView code we’ll have to follow so-called syntax rules. Those rules determine, like grammar rules of ordinary languages, what is and what isn’t allowed. They specify what code elements are allowed in which context and what characters we may use and where. Like grammar, syntax rules don’t forgive small mistakes. Even with one incorrect character we’ll get TradingView’s ‘syntax error at input’ error. Worse yet, with more experience we’ll still run into that error from time to time. That’s because all it takes for that error to appear is a simply typing mistake. >> great set of examples 19May2022 http://www.pinescripts.org/en/blocks-user-functions-if-and-for-commands/ ABOUT ‘IF’ STATEMENT Can not have commands after definition in the first line. The “else” word must be at the same level of margin of the “if” declaration and can not have other commands in the same line. ABOUT ‘FOR’ STATEMENT The first line only can have the loop configuration. >> Howell - this does't make sense!? The variable used for the loop counter can not be mutable. https://www.tradingview.com/pine-script-reference/v5/#op_for >> example of a variable in for statement from manual : qtyOfHigherCloses(lookback) => int result = 0 for i = 1 to lookback if close[i] > close result += 1 result >> Bullshit!!!!??? If so, how can one set the loop coun programmatically? Can include “break” or “continue” statements to manipulate the loop conditions interactively. The variable gets its value from the last tabulated line of the block. https://www.wordnik.com/words/mutable mutable myoo͞′tə-bəl adjective Capable of or subject to change or alteration.Prone to frequent change; inconstant.Tending to undergo genetic mutation. for i_priceFrac = 0 to 34 make sure tabs-only before "for" single spaces around "to" // will miss priceFrac lines just [above Hi, below Lo] // 18May2022 can reduce number of priceFrac lines.. maybe later if barstate.islast var int i_fracLo = 0 var int i_fracHi = 0 var float fibber = 0.0 var fracLine = array.new_float(n_bars, 0.0) var int i_priceFrac = 0 if fracTyp == "Fibonacci" for i_priceFrac = 0 to 34 if (priceFracLo < array.get(ary_fib, 34 - i_priceFrac)) i_fracLo := i_priceFrac if (priceFracHi > array.get(ary_fib, i_priceFrac)) i_fracHi := i_priceFrac for i_priceFrac = i_fracLo to i_fracHi fibber = array.get(ary_fib, i_priceFrac) fracLine = ratio_to_frac(priceFrac0 * fibber) plot(fracLine, color=color.navy, linewidth=3) fibLabel(i_priceFrac = priceFrac_label(fracLine(0), str.tostring(fibber)) else if fracTyp == "Liebnitz" simple_label( 100, priceFrac0, str.tostring("Liebnitz fra not yet coded (far mre complex - Fractional Order Calculus") else if fracTyp == "Puetz" for i_priceFrac = 0 to 17 if (priceFracLo < array.get(ary_Puetz, 17 - i_priceFrac)) i_fracLo := i_priceFrac if (priceFracHi > array.get(ary_Puetz, i_priceFrac)) i_fracHi := i_priceFrac for i_priceFrac = i_fracLo to i_fracHi fibber = array.get(ary_Puetz, i_priceFrac) fracLine = ratio_to_frac(priceFrac0 * fibber) plot(fracLine, color=color.navy, linewidth=3) fibLabel(i_priceFrac = priceFrac_label(fracLine(0), str.tostring(fibber)) else simple_label( 100, priceFrac0, str.tostring("Unrecognized fracTyp = " + fracTyp)) +-----+ #] 17Mar2021 search "TradingView PineScript and Mismatched input 'for' expecting 'end of line continuation'." https://stackoverflow.com/questions/51724359/i-got-tradingviews-end-of-line-without-continuation-error-with-pine-script The 'end of line without continuation' error happens when there's an indentation mistake in the TradingView Pine code. Looking at your code (and assuming copying it into StackOverflow went right), there is indeed an indentation problem: val(s) => if s != s[1] a = s-s[1] if s = s[1] a a There are two indentation problems in this code: The first 4 lines of the function are indented with 5 spaces (or 1 Tab plus a space). But code lines of a function need to be indented with 4 spaces (or 1 Tab) in TradingView Pine. The two lines that follow after the if statements are not indented. But they do need to be: with 4 spaces (or 1 Tab) or a multiple thereof. When we fix those two points the code becomes: val(s) => if s != s[1] a = s-s[1] if s == s[1] a a +-----+ #] 17Mar2021 search "TradingView PineScript and "cannot call 'array.get' ..." "TradingView PineScript and "cannot call 'array.get' with arguments (series[float], literal integer); available overloads: array.get(array[], series[integer]) => ;" # enddoc