Same Code but different results on different computers
Forums › ProRealTime English forum › ProOrder support › Same Code but different results on different computers
- This topic has 8 replies, 3 voices, and was last updated 5 years ago by Nicolas.
-
-
05/24/2018 at 7:00 PM #71297
Hi everyone,
I’m a little desperate because one code I wrote https://www.prorealcode.com/topic/automated-trading-with-pivot-points-and-dojis/page/5/#post-71278 works fine at other people’s computers but for some reason it doesn’t work properly on my computer. What could be the reason for something like that happening, in general?
Thank you for your help! 🙂
05/24/2018 at 7:25 PM #71300I’ve edited your post so that the link points to post with my cleaned up code that we know the results from and I’ll post it here too. Maybe others can test the code and report what results they have for the trade on 20 July 2017 at 13:30 and offer any ideas as to why it is not trading correctly for the OP.
The correct result can be seen here:
and the incorrect result can be seen here:
12345678910111213141516171819202122232425262728293031323334353637// EURO DOLLAR MINI 15 minDEFPARAM CumulateOrders = falseDEFPARAM FlatBefore = 000000DEFPARAM FlatAfter = 234500if OpenDayOfWeek = 1 thenPivot = (DHigh(2) + DLow(2) + DClose(2)) / 3S2 = Pivot - (DHigh(2) - DLow(2))endifif OpenDayOfWeek = 2 or OpenDayOfWeek = 3 or OpenDayOfWeek = 4 or OpenDayOfWeek = 5 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3S2 = Pivot - (DHigh(1) - DLow(1))endifdojisizes2d = 10dojis2d = Range >= ABS(Open[1] - Close[1]) * dojisizes2dabst2d = 8*pipsizeabstl2d = 2*pipsizesize = 4bullishs2d = (dojis2d and low[1] <= s2+abstl2d and low[1] >= s2-abst2d and close>high[1] and low>low[1])if bullishs2d thenldbs2d = low[1]-2Buy size Contract at Marketsell at ldbs2d stopendifif longonmarket thensell at ldbs2d stopendifif longonmarket and (close <low[1]) thensell at marketendif1 user thanked author for this post.
05/25/2018 at 8:08 AM #7132505/25/2018 at 8:23 AM #71329You are comparing 2 different instruments with not the same candlesticks’ OHLC. Even 1 pip could make a difference on how the strategy behaves.
I did consider this (I don’t have EurUSD Mini available to me) but the sell condition
123if longonmarket and (close <low[1]) thensell at marketendifshould be met on either chart as the close is less than the low. It is met on mine and Robertogozzi’s but not on the OP’s chart. It would be good if we could see the OHLC values on the chart where it does not close the position.
1 user thanked author for this post.
05/25/2018 at 9:16 AM #71337EURUSD mini with
1return close <low[1]indicator returns the same exact candle than the Spot instrument. Order should be closed here.. don’t know why it doesn’t.
Do someone tested
1GRAPH close <low[1]in ProBacktest?
1 user thanked author for this post.
05/25/2018 at 9:35 AM #71340The problem is fixed by modifying the end of the code:
1234567891011121314151617181920212223242526272829303132333435363738394041// EURO DOLLAR MINI 15 minDEFPARAM CumulateOrders = falseDEFPARAM FlatBefore = 000000DEFPARAM FlatAfter = 234500if longonmarket and (close <low[1]) thensell at marketendifif OpenDayOfWeek = 1 thenPivot = (DHigh(2) + DLow(2) + DClose(2)) / 3S2 = Pivot - (DHigh(2) - DLow(2))endifif OpenDayOfWeek = 2 or OpenDayOfWeek = 3 or OpenDayOfWeek = 4 or OpenDayOfWeek = 5 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3S2 = Pivot - (DHigh(1) - DLow(1))endifdojisizes2d = 10dojis2d = Range >= ABS(Open[1] - Close[1]) * dojisizes2dabst2d = 8*pipsizeabstl2d = 2*pipsizesize = 4bullishs2d = (dojis2d and low[1] <= s2+abstl2d and low[1] >= s2-abst2d and close>high[1] and low>low[1])if bullishs2d thenldbs2d = low[1]-2Buy size Contract at Marketsell at ldbs2d stopendifif longonmarket and (close <low[1]) thensell at marketendifif longonmarket thensell at ldbs2d stopendifSet the exit condition before adding the SELL STOP order solved it. I think that the “ldbs2d” is not at a correct level (above the current level?) and made the code crash somehow..
1 user thanked author for this post.
05/25/2018 at 10:52 AM #71342Set the exit condition before adding the SELL STOP order solved it. I think that the “ldbs2d” is not at a correct level (above the current level?) and made the code crash somehow..
That’s interesting. Is that something that PRT could put a fix in for as I suspect that it will not be the only time someone puts the sell orders in that order in a strategy?
1 user thanked author for this post.
05/25/2018 at 11:13 AM #7134305/25/2018 at 12:23 PM #71345 -
AuthorPosts
Find exclusive trading pro-tools on