abnormal behavior of if… and ..and ..and condition
Forums › ProRealTime English forum › ProOrder support › abnormal behavior of if… and ..and ..and condition
- This topic has 1 reply, 2 voices, and was last updated 5 years ago by Nicolas.
-
-
02/25/2019 at 5:47 PM #92284
Let’s say
1234buyCondition = average[10] crosses over average[30]if A and B and C and buyCondition then...endifthe result will be totally different from:
123if buyCondition and A and B and C then...endifI found this abnormal behavior when I do my experiment on Nicolas’s nice post (This abnormal behavior is nothing to do with the code of Nicolas’s post. I show the post here is just to give a code base for a quick experiment):
https://www.prorealcode.com/blog/learning/how-to-improve-a-strategy-with-simulated-trades-1
First, you can change the code block (at # line: 22):
12elsif not realtrading and ordercount>equityCurvePeriod then //fake tradingif not longontrading and buysignal theninto:
12elsif buysignal and not realtrading and ordercount>equityCurvePeriod then //fake tradingif not longontrading thenor
12elsif buysignal and not realtrading then //fake tradingif ordercount>equityCurvePeriod and not longontrading thenand run both. You can easily see the difference.
note that logic of code blocks is equivalent to:
1elsif buysignal and not realtrading and ordercount>equityCurvePeriod and not longontrading thenYou may switch each position of those conditions around. (and see the abnormal when buysignal is in 1st or 2nd position)
I don’t know whether such abnormal is due to PRT’s intrinsic bug or maybe there is a basic rule for if… condition that I don’t know yet.
Does someone know the cause? And how to avoid such unpredictable behavior?
ps. also there is a bug in backtesting when running for i=0 to aNumberLargerThan500, the “i” will never exceed 500. Everyone can reproduce it by putting this code into backtesting :
1234for i=0 to 999 docantBiggerThan500 = inextgraph cantBiggerThan500Is this bug will be fixed on next PRT version?
Thanks!
02/25/2019 at 6:16 PM #92286 -
AuthorPosts
Find exclusive trading pro-tools on