ParseError at [row,col]:[1,241]

Forums ProRealTime English forum ProOrder support ParseError at [row,col]:[1,241]

Viewing 9 posts - 1 through 9 (of 9 total)
  • #213875

    Hello, I started using the ProOrder system 1 week or so ago and I’m trying to build a simple script which will analyze price movements and buy or sell according to price reaction on key levels (past supports and resistances), for now the idea is to make it very basic then refine it, but I already have a hard time making the basic version start, when doing so PRT tells me (I tried to translate it the best I can since it wasn’t originally wrote in english) :

    ParseError at [row,col]:[1,241]

    Message: XML document structures must start and finish within the same entity

    This message isn’t really clear and makes it hard to debug the error, is there any way to access a more verbose debugger to track the issue?

     

    Anyway here is the code :

    I tried to target the error and it looks like this is this following part that is causing the error :

    Any idea about what I could have done wrong ?

    Thanks

    #213876

    Hi,

    Such a message generally is an indication that the PRT parser chokes on conditional stuff inside your code, which it tries to be intelligent about (predict what variables are going to be used downstream so they don’t need to be explicitly defined by you, the coder). Generally you can’t help it going wrong, as in all cases I run into it, it’s just a PRT bug. Easy example :

    This may go wrong depending on unknown internal situations, and the solution is to remove (comment out) that If GraphOn and adjacent Endif.

    In your situation the For loop including the Sell and ExitShort commands, look sufficiently suspicious to me to avoid. So notice that your conditions would allow to trigger several of either, and the choking is on. You could cover for this technically wrong setup by means of tracking that one of the commands has been executed already (thus, formally you will be off market in the next call of the bar/code) so you won’t execute a next which would overrule the previous. In your case you’re thus not only overruling a former Sell with a Sell, but you will also overrule a former Sell with an ExitShort. And vise versa.

    Try it out quickly by means of looping one time only (not 7 times (0 to 6)) and comment out the ExitShort (or Sell).

    Heads up, because what you do seems nice. 🙂
    Peter

    1 user thanked author for this post.
    #213883

    Deleted as I proved myself wrong! 😉

    #213884

    Thanks for the heads up!

    I tried multiple things :

    • Doing only one looping and commenting out everything except one BUY command
    • Breaking out of the loop when one the Buy, Sell, SellShort, ExitShort command is called
    • Putting NOT OnLongMarket AND NOT OnShortMarket in the conditions so multiples commands aren’t called during the same looping
    • Putting every conditions in his own loop and Breaking out of it as soon as the condition is met

     

    But to no avail for now.

    As I said the error disappears when I comment out this part within the loop:

    So maybe the choking is happening during the modification of the variables in those conditions? Would it be possible according to your knowledge?

    Anyway I’m going to keep fiddling with it

    #213886

    Looks like it is the expressions like

    that are causing the error

    1 user thanked author for this post.
    #213892

    Maye you can concentrate on the part above;
    So you’re inside of an If conditioned by an array variable which you set within that If ( $PriceMem[x] ).

    Normally this can be done of course, but arrays could be too much of a tweak for PRT itself to have thought of this situation.

    Untested of course so I hope I have the logic right.

    Because this is so often about “structures”, also think of this setup which is more common to PRT coding/coders :

    I wouldn’t do it like that by nature, but still it is a means, and it avoids more “structure” as such for the “parser”.


    Do you receive the error during Optimization (iterating over Optimization Variables) ? or do you receive the error when the backtest tries to show the Stats of the result ?
    When you don’t recognize “Optimization” as such, you would not be able to tell, unless without the error the result is there 50 times faster. I hope this is clear ?
    Just in case it is new to you, Optimization makes use of the form with at the bottom of it what you see below.

    #213894

    Thanks, I tried that too but it didn’t change the result.

    In fact I think the error only comes from the fact that I’m using “CROSSES OVER/UNDER” for a curve (the price) in relation to a single price, the documentation stipulates that CROSSES OVER/UNDER is to be used to compare 2 curves, so maybe that’s just it unless it is supposed to also work the way I did it…

    #213895

    It’s not possible to use CROSSES OVER/UNDER with arrays as they are NOT historicized, i.e. $myElement[N]  will only retain the current value, as it’s not possible to access the value retained the prior candle. Whenever you change it, the previous value is lost.

    CROSSES means comparing the previous valus with the current one. Since only the current one is available, those instructions cannot be used. If you know what element is to be compared, I suggest to assign its value to a variable,  provided you know what element of the array is the one to be tested:

    this will work, as I only want to test element 1:

     

     

    2 users thanked author for this post.
    #213897

    Alright, it makes sense now.

    I just ended up using open < value AND close > value instead

Viewing 9 posts - 1 through 9 (of 9 total)

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