Forums › ProRealTime English forum › ProOrder support › Strange if condition code error › Reply To: Strange if condition code error
Late reply, been out all day + the world cup.
Nicolas.
No the tradecount variable works as I also mentioned in the comments in the code. The problem is that the second if statement is flawed (all if statements after the first one), first it works since the tradecount is 1 from Long 1 (otherwise the if statement wouldn’t go ahead), but instead of buying, which comes before the tradecount addon, the tradecount addon seem to be done first and when it’s done the Long 2 if statement aren’t correct anymore and the buy order isn’t done and it goes to the next if statement which I didn’t include in the code above.
The third statement (Long 3) had tradecount = 2 and would buy if it had no tradecount addon (as in the Long 2 statement), if it had the tradecount addon it wouldn’t buy either (same problem). The third (Long 3) couldn’t be activated if the Long 2 statement wasn’t first correct and the addon was done, the problem seem to be within the ProOrder Interpreter/Compiler (bugged), because how can the addon be done but not the buy order on the previous line in the same accepted if statement? The if statement should do everything between then and endif (unless else and such) and then go to the next if statement, not go back to the beginning of the current if statement.
To add to this, I had 4 contracts in Long 3 statement and after buying 1 contract in Long 1 (with a loss) and then Long 2 got activated, but not buying anything, the system would then go to Long 3 and buy 4 contracts instead (had buying 2 contracts in Long 2). And because of CumulateOrders = False I thought the next if statment wouldn’t get activated, but I guess it does, so I need to use “not onmarket”, I’ve tested with it though but with the same problem (addon is done but not the buy order before).
Vonasi.
The code wasn’t intended to open more positions until the previous one was done. I know how CumulateOrders work.
I was playing around with entering once during the morning (1 contract) and if a win the system was done for the day (the firsttarget = 1 in the longonmarket if statement), but if a loss it would enter again once the conditions was correct, but this time with 2 contracts. But this didn’t work because of the compiler problems within ProOrder (as I see it).