Forums › ProRealTime English forum › ProOrder support › Strange if condition code error › Reply To: Strange if condition code error
Actually that proves that there is a problem.
No it proves there is not a problem. You are not on the market – the code is read from top to bottom at the close of a candle. Long1 criteria is read and all conditions met and tradecount is set at 1. Then Long2 is read and all conditions are met because Long1 just changed them so Long2 then sets tradecount to 2. Then Long3 is read and Long2 just set all the conditions for it so tradecount is set to 3. At no point up to now has anything been bought as that order does not go to the market until the last line of code has been read.
You are wrong speaking about pretty much every other programming language in the world. If it goes from top to bottom and not everything is done at the same moment (as it could do with the future quantum computing as an example), it should go from top to bottom doing one if statement at a time (not all at a time), if not – this is the bug in PRT’s compiler. It should be like this:
Checking Long 1
Long 1 accepted
buys contract
adds the tradecount value by one
closes the statement
Moves to the next statement,
checking Long 2
since contract was bought in previous statement we are “on market”
Long 2 not accepted and closed.
Same thing for Long 3.
Now check the easy batch file for Windows I created in my previous post and test it, even that easy language which also moves from top to bottom works as intended. Please reply after testing the batch file. I don’t have time to prove the concept in VB, c, c++, c#, php, python and so on, most (or all) languages work this way except this problem within PRT.