PRT goes against rulesIF NOT LongOnMarket AND LongCondition AND belowred = 1 TH?
Forums › ProRealTime English forum › ProOrder support › PRT goes against rulesIF NOT LongOnMarket AND LongCondition AND belowred = 1 TH?
- This topic has 7 replies, 2 voices, and was last updated 8 years ago by Jerry.
-
-
04/05/2016 at 7:26 AM #4869
Hi guys,
I’ve found a very interesting “bug”. For some reason it seems that PRT sometimes ignores a very important condition and goes for it anyway. In my code I have this:
1IF NOT LongOnMarket AND LongCondition AND belowred = 1 THENNotice the “belowred = 1”. That’s my on/off trigger for buy, if it’s 0 then no go. Once i’m in the market it goes to zero and waits for a specific condition to switch back on. That works like a charm.
However, PRT ignores it and takes a trade I don’t want! Look at the attached image. That IF statement is the only place in the code where a buy order is issued… Anyone else have this kind of hick-ups? Errors like this is very costly and if this is a true PRT error it is very serious.
04/05/2016 at 8:45 AM #487404/05/2016 at 8:54 AM #4875Arn’t those just a result of lag? Here is the full code (a bit messy though):
123456789101112131415161718192021222324252627282930313233343536//Conditions för long re-entryONCE belowred = 1IF belowred = 0 AND low< MAH10 AND NOT LongOnMarket THENbelowred = 1ENDIF// Conditions to enter long positionsMAL8 = Average[8](low)MAH10 = Average[10](high)William = WilliamsAccumDistr(close)WilliamMA = Average[57](William)LongCondition = low[1] > MAH10 AND open > MAH10 AND MAH10>MAL8 AND William>WilliamMAIF NOT LongOnMarket AND LongCondition AND belowred = 1 THENBUY 100 CONTRACTS AT MARKETprofittake = high+((high-low)*2)belowred = 0ENDIFgraph belowred// Conditions to exit long positionsIf LongOnMarket AND open>profittake THENSELL AT MARKETENDIF//SL om hamnar under blå (MAL8)If LongOnMarket AND close<MAL8 THENSELL AT MARKETENDIF04/05/2016 at 10:14 AM #487804/05/2016 at 10:22 AM #488004/05/2016 at 10:54 AM #4883For me everything is working well. Your GRAPH instruction draw your “belowred” variable that is reset to 0 each time you take a trade on line 21. That’s why you may think that PRT take the trade in “inverted” mode despite of this variable value.
04/05/2016 at 7:11 PM #490004/07/2016 at 9:17 AM #4996Hi,
I’m still having a bit of trouble figuring this one out (this time it’s a reverse problem). Obvious entry is missed completely or severely delayed. Kindly look at the attached image, there should be an entry at X:
1LongCondition = low[1] > MAH10 AND open > MAH10 <code class=" language-prorealtime"><span class="token keyword">AND</span> MAH10<span class="token operator">></span>MAL8 </code><code class="language-prorealtime">AND William>WilliamMA- Bar before above red line? Check.
- Open above red line? Check.
- Red line above blue line? Check.
- William above Williams MA? Check.
- belowred = 1? Check.
Yet no entry at all…
Now let’s have a look at Y:
Same conditions as above, all check. Yet the entry is at 5th bar!
Is it possible that “AT MARKET” sometimes fail or is greatly delayed? Or am I missing something here?
-
AuthorPosts
Find exclusive trading pro-tools on