Warning 514 - you can’t have NEW LINES in parameter names_Reopen

For below piece of code I have warning only


WriteIf( Highest( doubletop ) == 1, "detected some possible 
double top patterns for " + Name() + "\nLook for green arrows on the price 
chart.", "There are no double top patterns for " + Name() ); 

After applying same it became error, is there a way to ignore same completely
I understand the solution is to remove the new line, but I had multiple of these after cloning from my version control repository,

I suggested to chatgpt regex like "([^"]*?)\r?\n\s*([^"]*?)"
I.e found and replace with regex match group

But It seems it's not very generic and I don't want to make it more generic to match codes with no issues
If anyone have any suggestion, It would be much appreciated

Your example is not consistent.

Has \n in the original code been replaced by new line character OR has it been replaced with new line and the \n in actual code is also present?

String literals should be in one line in AFL. ( backslash doesn't delimit in AFL editor )

// this type would be OK
"detected some possible double top patterns for " + Name() + 
"\nLook for green arrows on the price chart."

// but not this
"detected some possible double top
patterns for " + Name() + 
"\nLook for green arrows on the 
price chart."

You could use Notepad++ but your sample is not consistent. Post something realistic.

@nsm51 line 2 ends with

"\nLook for green arrows on the price

line 3

chart.", "There are no double top patterns for " + Name() );

You may replace the condition in writeif by true

I will highlight warning in screenshot if it's not clear but for now as I am replying from mobile

I was just wondering if it's detected only as warning in afl editor might be there is a way to turn that off in chart as well

I understand how to correct it but the issue is I had that for lots of formula as I highlighted

Here is the exact issue

The solution would be to end that line with quotes and add + and opening quote in next line
or opening and ending quotes in same line
But I had same on lots of formula, is there any way to automate same or ignore it.

Please do read this:

2 Likes

@Tomasz Thanks solved by setting SetOption("WarningLevel", x );
Now my automation plan would be to replace all formula files first line with same, or an include file for future use if any other option needed.

It is better to fix formulas than suppressing warnings.

@Tomasz Thanks again
I have 9289 hits with same issue. :smiley:
I would happily suppress the warning and accept discovering coding mistake on chart :smiley:

This is the output of one regex checking opening quote in line with no ending quote
There is still possibility for 3 quotes,5 quotes , ....

Search "^[^"\r\n]*"[^"\r\n]*$"(9289 hits in 2472 files of 34374 searched) [RegEx]
I don't use all formulas but it is in my repo anyway.

I don't know from were did you get those 34374 files. Internet is full of garbage, not everything is worth using.

2 Likes

Just for complete reference of the solution according to my case
Here is the regex to find first line and replace

  • Find what: (?-s)\A^.*$
  • Replace with: ADD_NEW_CODE_HERE; $0