Something is missing in my "Friday Sell-off"
Forums › ProRealTime English forum › ProOrder support › Something is missing in my "Friday Sell-off"
- This topic has 4 replies, 3 voices, and was last updated 7 years ago by Nicolas.
-
-
06/23/2017 at 10:32 AM #38879
This is my first backtest, just trying to create a simple test to take a look at sell-offs in S&P500 during the last 45 minutes on Fridays.
It seems that I am missing something as I don’t get any results.. I want to look at in in the 5 minutes timeframe and I’ve put in MA8 and MA16, I want to enter a short position (and vice versa for long) when MA8 crosses under MA16 and I want it to exit the position when price goes over MA8 or 10 minutes after closing time of the stock exchange (which in my case is 22:10 as I’m located in GMT+1). Attached you can see a pic of what I’m looking to capture, however the attached pic is of a Thursday but it is just to show you what I’m looking for.
What am I missing?
Thanks in advance for any help! 🙂
Sell-off / buy-in Fridays12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 212500// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 221000// Prevents the system from creating new orders to enter the market or increase position size before the specified timenoEntryBeforeTime = 212500timeEnterBefore = time >= noEntryBeforeTime// Prevents the system from placing new orders to enter the market or increase position size after the specified timenoEntryAfterTime = 221000timeEnterAfter = time < noEntryAfterTime// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 2 OR OpenDayOfWeek = 3 OR OpenDayOfWeek = 4 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsindicator1 = Average[8](close)indicator2 = Average[16](close)c1 = (indicator1 CROSSES OVER indicator2)IF c1 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsindicator3 = Average[8](close)c2 = (close < indicator3)IF c2 THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator4 = Average[8](close)indicator5 = Average[16](close)c3 = (indicator4 CROSSES UNDER indicator5)IF c3 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Conditions to exit short positionsindicator6 = Average[8](close)c4 = (close > indicator6)IF c4 THENEXITSHORT AT MARKETENDIF// Stops and targetsSET STOP pTRAILING 10SET TARGET pPROFIT 3006/23/2017 at 10:54 AM #38881Something wrong in your conditions:
12graph c1 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry coloured (0,200,0)graph c3 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry coloured (200,0,0)Don’t return any valid signals in backtests. You should test each of all your conditions, to know which one prevent a signal to be valid.
06/23/2017 at 11:21 AM #3888306/23/2017 at 11:28 AM #38884I think Nicolas means for you to backtest 1 condition and then include a 2nd condition and then a 3rd etc. When you include a condition which stops trades then you know that is the condition with the error?
1 user thanked author for this post.
06/23/2017 at 12:09 PM #38890This is all conditions that trigger a BUY order:
c1 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry
All these conditions are not met at the same time and that’s why you never get any long entry. I suggest to GRAPH one condition by one in backtests to know why it happens.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on