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:

Viewing 15 posts - 1 through 15 (of 19 total)
  • #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.

    1. Backtests are complete without any issues.
    2. 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.
    3. 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.
    4. 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.
    5. 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.

    #195612

    Did 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:

    1. copy/paste the code from ProBacktest window into a text application (such as notepad in Windows).
    2. delete the code from the probacktest window
    3. copy/paste the code from the text app into the probacktest
    4. run a backest

    Or

    create a new probacktest and copy/paste the code from the text app into that new backtest.

     

    #195615

    Hi @pietertal, if you can show the first say 10 lines of your code, it would be rare if I can’t see what to do to solve it (could require a few more questions and answers).
    Regards,
    Peter

    #195622

    Hi 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 = Step

     

     

    #195624

    Hi 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.

    #195625

    Could you please copy/paste here the line 8? 🙂

    #195635

    Hi Nicolas

    Below as requested.

    BL2 = CALL “220513_Ind_Base Line”[P2]

    I do not think it is related to the specific code in line 8 as I can re-order the code so line 8 is empty and it will still show line 8 error.

    #195648

    Now, let’s see …

    Can you comment-out this line and see whether this makes a difference ?

     

     

     

    Never mind the attachment below.

    #195650

    Also, do you use the TimeFrame command ? (could be in the Strategy main code – could be in the Indicator)

    #195652

    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.

    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.
    #195653

    Another one : Did you make all variables from the Optimization Table Fixed (activate them in the first column) ?
    See the first line below … that is WRONG. And may cause this error.

    #195658

    Just to be sure, the ” must be of that type (and not the ones you have pasted above)

     

    1 user thanked author for this post.
    #209985

    Thanks 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.

    #216009

    Hi 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?

    #216021

    Maybe totally unrelated but did you take care of defining that parameter as Decimal in the Indicator ?

Viewing 15 posts - 1 through 15 (of 19 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login