Error: Unknown Command. Code is invalid. Please correct it line 8:
Forums › ProRealTime English forum › ProRealTime platform support › Error: Unknown Command. Code is invalid. Please correct it line 8:
- This topic has 18 replies, 4 voices, and was last updated 1 year ago by GraHal.
-
-
06/20/2022 at 9:43 AM #195609
I am getting the above error regularly when I am preparing my code for automatic trading. I do not believe it is related to a specific piece of code due to the following reasons.
- Backtests are complete without any issues.
- After completion of a backtest, I would for ex. select the gear button on the top result and it will give the error. If I however select the second result the system will progress to auto trading.
- If I enter spaces in my code to allow a clear line at line 8 where the error apparently exist the error stay at line 8. It does not move with a specific line of code.
- At times if I delete the last variable in the optimization table the line 8 error will clear to come up with a different error to say a variable is missing.
- There are no red markings or warnings on or next to any of the code as you would get during coding if the line is not completed yet.
Any assistance would be appreciated to try and clear this error.
06/20/2022 at 9:54 AM #195612Did you copy/paste the code from another application, such as a note application, a text pad, an email, or a forum? Sometimes ASCII character could lead to that kind of error.
What I would recommend is:
- copy/paste the code from ProBacktest window into a text application (such as notepad in Windows).
- delete the code from the probacktest window
- copy/paste the code from the text app into the probacktest
- run a backest
Or
create a new probacktest and copy/paste the code from the text app into that new backtest.
06/20/2022 at 11:12 AM #19561506/20/2022 at 12:57 PM #195622Hi Peter
See below first 11 lines …
I have also tried the option to replace the “Call” functions with the actual indicator codes. The error still come up when selecting “prepare for automatic trading” or selecting a result from the backtest result screen.
// Definition of code parameters
// Cumulating positions deactivated
DEFPARAM CumulateOrders = False// Indicators
BL1 = CALL “220513_Ind_Base Line”[P1]
// P1 = Step
BL2 = CALL “220513_Ind_Base Line”[P2]
// P2 = Step
BL3 = CALL “220513_Ind_Base Line”[P3]
// P3 = Step06/20/2022 at 1:04 PM #195624Hi Nicolas,
Due to the issue I had used a new fresh window and typed all the code from start before submitting this post. Did not make a difference. In anycase to try …. I have actioned as per your recommendation to notepad and also started a new fresh window. Result is the same. Still error in line 8.
06/20/2022 at 1:23 PM #19562506/20/2022 at 1:45 PM #19563506/20/2022 at 2:39 PM #19564806/20/2022 at 2:40 PM #19565006/20/2022 at 2:43 PM #195652At times if I delete the last variable in the optimization table the line 8 error will clear to come up with a different error to say a variable is missing.
This is normal, because that variable will be missing if you delete it. Can you :
Add all the variables from the optimization table right under the DefParam line ? Just let them be in the Optimization table !! (this is crucial).
Now waiting for your answers first. 🙂
1 user thanked author for this post.
06/20/2022 at 2:48 PM #19565306/20/2022 at 3:10 PM #19565802/20/2023 at 3:43 PM #209985Thanks for all the assistance. The adding of the variables after DefParam line seems to fix the issue if a specific code have some issues to start. It is interesting that I do not have to do this for all strategies. In most of my code the program add the variables itself.
06/12/2023 at 3:53 PM #216009Hi All,
I am having an issue again with “Code is invalid” when I am trying to prepare for automatic trading. Tried again all the suggestions as proposed before with no effect. What I realise is that I am only having this issue when I am working with FX and using decimals in variable optimisation parameters.
In the attachment – “Values after the decimal point” the code invalid line is given.
If I just enter the values without the decimal point it clears the fault code. See in the attachment – “No values after the decimal point”.
If I enter the values in the actual code the automatic trading preparation adds the variable parameters again. Obviously, this is wrong as we will have two sets of values for the same parameters – See in the attachment – “Prepared Code”.
Any suggestions? Do you have this problem when using values smaller than whole numbers in the variable table during optimization?
06/12/2023 at 6:12 PM #216021 -
AuthorPosts