Backtesting chooses entries and exits at random
Forums › ProRealTime English forum › ProOrder support › Backtesting chooses entries and exits at random
- This topic has 6 replies, 3 voices, and was last updated 6 years ago by
GraHal.
-
-
10/29/2019 at 9:43 PM #111576
Hi Everyone
I am quite new to ProRealTime. I have made a number of short programs, but am puzzled by my latest program which gives entries and exits seemingly at random. I have created the program with ‘simplified creation’ and then modified it slightly (same result without any modification as well).
It is very simple. When two moving averages (21 and 50 period) are both moving up I want to create a buy order. When the 21 starts to move down I want to close the position. I am running the code on the US 500 Cash 5 min market. The code even enters a buy when both moving avergaes are moving down. I am very confused.
Last point, if one creates a Hull moving average with the simplified creation, the code defaults to simple moving average. There does not seem to be a programming option for the Hull at all. I have seen other people say similar on the forums but no definitive answer to date.
Simple code1234567891011121314151617181920// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsindicator1 = Average[21](close)c1 = (indicator1 >= indicator1[1])//21 period average is sloping positiveindicator2 = Average[50](close)c2 = (indicator2 >= indicator2[1])//50 period average is sloping positiveIF c1 AND c2 THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsindicator3 = Average[21](close)c3 = (indicator3 < indicator3[1])//close when 21 period average is sloping negativeIF c3 THENSELL AT MARKETENDIF10/29/2019 at 10:58 PM #111588What timeframe are you running your code on?
I ask because if a low TF (1 min, 5 min) then it may be difficult to spot the difference of say 1, 2 or a few pips on the MA’s??
Give an example of a random entry / exit date & time and I’ll try and reproduce on my Platform.
10/29/2019 at 11:37 PM #111593Hi GraHal
I am using this on the 5 min chart. See attachment for trades over the last few hours. Time is CET +1.
At 22:15 there is an entry an 1 candle later an exit. Both MA’s are moving downwards so there should not be any entry.
Thank you
10/30/2019 at 12:08 AM #11159610/30/2019 at 12:19 AM #111597What instrument are you testing on? It is not mentioned in your first post or shown in your screen shot. We cannot recreate what is happening without all the info!
Also are you sure that the MA’s on your chart are the same as in your code? Just trying to eliminate the usual basic mistakes before delving deeper.
Using GRAPHONPRICE to show the MA values directly from the strategy is usually a good way to avoid confusion.
1 user thanked author for this post.
10/30/2019 at 8:14 AM #11160810/30/2019 at 9:58 AM #111620 -
AuthorPosts
Find exclusive trading pro-tools on