Trades not opening at set time and strategy stopped but still running!
Forums › ProRealTime English forum › ProRealTime platform support › Trades not opening at set time and strategy stopped but still running!
- This topic has 30 replies, 3 voices, and was last updated 6 years ago by Vonasi.
-
-
07/27/2018 at 3:24 PM #76899
I have been carrying out a test with two strategies to try to confirm what the spread actually is at set times of the day. One opens a long position at set times and the other a short position at the same times and then they both close them a minute later. They are programmed to open positions on every half hour and every hour. I have had them running on demo on the DJI minute chart since yesterday at 1430 BST – so for over 24 hours now.
During that time both long and short strategies failed to open positions at 1830, 2100, 2230, 0830, and 1100. There are no rejected orders in my order list so the orders were never even created.
Then at 1230 both strategies stopped opening positions completely. They are still shown as running in the list of strategies but there is a black line on the performance graph equity curve. See image:
I’m thinking that they were stopped due to the following being set to 50:
…but that does not explain why they both failed to open several positions during the 24 hour period.
I will send a report to PRT.
The code was simply this and the opposite for shorts positions:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151//-------------------------------------------------------------------------// Main code : Long Spread Test//-------------------------------------------------------------------------if time = 000000 thenbuy 1 contract at marketendifif time = 010000 thenbuy 1 contract at marketendifif time = 020000 thenbuy 1 contract at marketendifif time = 030000 thenbuy 1 contract at marketendifif time = 040000 thenbuy 1 contract at marketendifif time = 050000 thenbuy 1 contract at marketendifif time = 060000 thenbuy 1 contract at marketendifif time = 070000 thenbuy 1 contract at marketendifif time = 080000 thenbuy 1 contract at marketendifif time = 090000 thenbuy 1 contract at marketendifif time = 100000 thenbuy 1 contract at marketendifif time = 110000 thenbuy 1 contract at marketendifif time = 120000 thenbuy 1 contract at marketendifif time = 130000 thenbuy 1 contract at marketendifif time = 140000 thenbuy 1 contract at marketendifif time = 150000 thenbuy 1 contract at marketendifif time = 160000 thenbuy 1 contract at marketendifif time = 170000 thenbuy 1 contract at marketendifif time = 180000 thenbuy 1 contract at marketendifif time = 190000 thenbuy 1 contract at marketendifif time = 200000 thenbuy 1 contract at marketendifif time = 210000 thenbuy 1 contract at marketendifif time = 220000 thenbuy 1 contract at marketendifif time = 230000 thenbuy 1 contract at marketendifif time = 300000 thenbuy 1 contract at marketendifif time = 013000 thenbuy 1 contract at marketendifif time = 023000 thenbuy 1 contract at marketendifif time = 033000 thenbuy 1 contract at marketendifif time = 043000 thenbuy 1 contract at marketendifif time = 053000 thenbuy 1 contract at marketendifif time = 063000 thenbuy 1 contract at marketendifif time = 073000 thenbuy 1 contract at marketendifif time = 083000 thenbuy 1 contract at marketendifif time = 093000 thenbuy 1 contract at marketendifif time = 130000 thenbuy 1 contract at marketendifif time = 113000 thenbuy 1 contract at marketendifif time = 123000 thenbuy 1 contract at marketendifif time = 133000 thenbuy 1 contract at marketendifif time = 143000 thenbuy 1 contract at marketendifif time = 153000 thenbuy 1 contract at marketendifif time = 163000 thenbuy 1 contract at marketendifif time = 173000 thenbuy 1 contract at marketendifif time = 183000 thenbuy 1 contract at marketendifif time = 193000 thenbuy 1 contract at marketendifif time = 230000 thenbuy 1 contract at marketendifif time = 213000 thenbuy 1 contract at marketendifif time = 223000 thenbuy 1 contract at marketendifif time = 233000 thenbuy 1 contract at marketendifif onmarket thensell at marketendif07/27/2018 at 9:20 PM #7692507/27/2018 at 10:55 PM #76929Another glitch you have uncovered
Yes and quite worrying one. To not open 5 trades out of I believe 38 on a 1 minute time frame when the strategy only has one condition (time) is quite a failing. I am sure there will be some logical reason why that I have not considered but at the moment I cannot think what.
Personally I would never use time as a criteria in my decision as to whether to enter a trade or not. Time is never more important than price!
The other issue of the strategy stopping I confirmed as having my orders limited to 50 as when I went back to the platform after posting and clicked on the running strategies window it updated and showed them as stopped and the reason given was what I suspected. I guess we still have the problem of that window going to sleep and not updating!
1 user thanked author for this post.
07/28/2018 at 10:11 AM #76940Line 76 should read 003000 instead of 300000.
Line 106 should read 103000 instead of 130000.
Line 136 should read 203000 instead of 230000.
With the above correction, backtesting it on EurUsd, 1 minute, from july 25th at 23:59 through July 26 at 23:59 opens exaclty 48 trades, as from attached screenshot.
Thos code will yield the same results:
123456IF OnMarket THENSELL AT MARKETENDIFIF openminute = 0 OR openminute = 30 THENBUY 1 CONTRACT AT MARKETENDIFand it’s a bit less time consuming!
1 user thanked author for this post.
07/28/2018 at 11:11 AM #76954Thanks for pointing those typos out Robert – not sure why they are in there and I don’t think they can be in the code I ran live as it opened trades at 0030 and 1030 but did not open one at 0830. I will have to double check.
While writing it I did think there must be a shorter way to write this but with cut and paste and find and replace it would have taken longer to think of the idea than to just get on and do it so I just got on and did it – but the find and replace may be why there are some typo errors!
Back testing works fine but the issue is that when running live it failed to open trades. I will double check the code and see what typos were in the ones that I ran.
07/28/2018 at 11:28 AM #76958Robert – Your code should use MINUTE rather than OPENMINUTE otherwise the trades are not opened on the hour and half hour exactly but a minute later.
I checked the codes that I ran and there were the typos in there. Here are two images of the trades opened and it clearly shows trades opened at times when there were typos in the code.
So the strategies opened live trades at 0030 1030 and 2030 when they should not have done and failed to open trades at 0830 1100 1830 2100 and 2230 when they should have done.
1 user thanked author for this post.
07/28/2018 at 12:08 PM #76965So the strategies opened live trades at 0030 1030 and 2030 when they should not have done and failed to open trades at 0830 1100 1830 2100 and 2230 when they should have done.
Just so I am clear … is above the case with Roberto code also (with minute instead of openminute)?
07/28/2018 at 12:14 PM #76966Just so I am clear … is above the case with Roberto code also (with minute instead of openminute)?
I would need another 24 hours to run Robertogozzi’s code live! I’m not going to do that just yet as I think it will just add confusion. The code I wrote should not have opened some trades and did not open other trades that it should have. I think I’d rather wait for PRT to respond before confusing things any further with a test of a different strategy.
Also when I run them – it makes my demo account balance look terrible! Maybe you could run it on yours?
07/28/2018 at 12:45 PM #76967Maybe you could run it on yours?
Yeah I will, I’ll run Roberto code! Good call! 🙂
07/28/2018 at 12:53 PM #7696907/28/2018 at 2:56 PM #76977Are you running the test code on real account (live) or just backtesting it?
I just backtested my code (with minute instead of openminute) with both BUY and SELL and 48 trades have been opened/closed, on my real IG account, pasting them to eXcel didn’t outine any spread (difference in price), but there’s no evidence of spread, I guess backtest doesn’t care about it.
See the attached pics (partial results) and .XLS file (full results).
07/28/2018 at 3:03 PM #76981Live on demo – it was a test to gather live long and short entry prices to test when spread actually changed and whether it actually was what the brokers say it should be.
https://www.prorealcode.com/topic/when-does-spread-actually-change/
07/31/2018 at 10:24 AM #77162Maybe you could run it on yours?
Yeah I will, I’ll run Roberto code! Good call! 🙂
Did your 24-hour test complete (I have 25 strategies running on Demo and cannot add more, still have some in the queue waiting)?
07/31/2018 at 10:45 AM #77175I have 25 strategies running on Demo and cannot add more
You need to open some extra IG/PRT accounts to run extra demo platforms on. I have two accounts and also my girlfriends account so I get to test 75 strategies at the moment. I suspect that one day IG will shut one of the accounts down for lack of use with live trading (they have done this to me before!) so I might have to do the odd manual trade if I want to keep it going.
The 25 strategy limit on the demo platform is ridiculously low for our forward testing needs in my opinion. It should be the other way round – we should have 25 for live trading and then pay for more slots if we need them and 100 for demo trading. It is obvious that most people will have more strategies on test than they will have running live – or do PRT/IG actually want to rush us to put untested strategies live too soon? I think they might have an interest in that happening!
07/31/2018 at 10:54 AM #77184Thanks Vonasi, I’ll try to open one on my daughter’s name.
-
AuthorPosts
Find exclusive trading pro-tools on