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/31/2018 at 8:09 PM #7721307/31/2018 at 8:47 PM #7721707/31/2018 at 9:04 PM #7722007/31/2018 at 9:38 PM #77222
Good job you checked Vonasi as I thought I was looking at spreads changing when IG say they do!
That would also be interesting to check (my checks of my own results showed everything to be as it should be and with no slippage) but first of all I think we need PRT to explain why both simple time based strategies fail to place trades at some times. I also do not understand why my version placed trades at times that are not in the code!
08/01/2018 at 1:09 AM #77231Instead of bothering about minutes, I want to test this single line strategy on EurUsd, 30-minute TF, only opening positions, without closing them, one for LONGs:
1BUY 1 CONTRACT AT MARKET //will buy once per bar, every thirty minutesand one for SHORTs:
1SELLSHORT 1 CONTRACT AT MARKET //will sell once per bar, every thirty minutesafter one day I’ll quit them and I’ll copy data to eXcel and to compare results and spreads.
edit: backtest looks fine, but live demo doesn’t!
1 user thanked author for this post.
08/01/2018 at 8:57 AM #77238Here’s the results of my 24 hour + running of Roberto code.
For the sake of completeness and – for the convenience of PRT when they check out this Thread – the code I used is provided below …
LONG
123456789//-------------------------------------------------------------------------// Main code : Vonasi Spread Test Long//-------------------------------------------------------------------------IF OnMarket THENSELL AT MARKETENDIFIF minute = 0 OR minute = 30 THENBUY 2 CONTRACT AT MARKETENDIFSHORT
123456789//-------------------------------------------------------------------------// Main code : Vonasi Spread Test Short//-------------------------------------------------------------------------IF OnMarket THENExitShort AT MARKETENDIFIF minute = 0 OR minute = 30 THENSellshort 2 CONTRACT AT MARKETENDIF08/01/2018 at 9:03 AM #77241backtest looks fine, but live demo doesn’t!
Robertogozzi – your new test idea is a good one as it eliminates the TIME element as being the issue and will confirm that it is an issue of orders not being sent.
In what way – not fine? Not opening some trades I’m guessing.
08/01/2018 at 9:20 AM #77247Yes it opened an order as soon as the first bar closed but no more!
Backtesting, on the contrary, is super fine!
I will report it to PRT, but I agree on the fact that there must be some issues in the communication area between PRT and IG.
08/01/2018 at 9:24 AM #77250Yes it opened an order as soon as the first bar closed but no more!
I wonder if it is worth trying this to compare:
123defparam cumulateorders = truebuy 1 contract at marketand maybe one that closes the position.
12345buy 1 contract at marketif onmarket thensell at marketendif08/01/2018 at 10:40 AM #77277The one that closes the position only opens a new trade every other bar, because it takes a bar to close the previously opened trade.
If you move your lines 3-5 before line 1, then it opens only ONE trade, no matter whether DEFPARAM CumulateOrders = TRUE.
08/01/2018 at 10:48 AM #77278Well spotted – that is what happens if you type without thinking!
So you are saying that no matter what version you test it only opens one trade and then no more?
I wonder what happens if you put the BUY entry within an IF THEN with a condition set permanently to true.
Maybe PRT have a way of sensing when a strategy could empty an account and so stop it trading?
08/01/2018 at 11:02 AM #77281Maybe PRT have a way of sensing when a strategy could empty an account and so stop it trading?
My demo (solely) account has a balance of over € 13,000,000 so opening even a hundred 1-contract trades should not be an issue! Moreover, I start both the LONG and SHORT versions, so they should almost balance out!
I’ll test the BUY/SELLSHORT condition within IF..ENDIF set to true.
08/01/2018 at 11:19 AM #77284I was thinking that maybe they just have a basic check that a strategy is not able to just put orders to market without some conditions being involved as if someone accidentally coded it like that and then ran it live and went on holiday they would have a shock when they came back. It saves a lot of arguing with customers if you only let strategies place one trade in that situation.
That would still not explain the issue with the time based strategies missing trades and placing trades when no condition was met. We seem to now be testing for two issues!
08/03/2018 at 10:53 AM #77458I decided to do a test this morning (backtest only). So I tested four combinations of BUY and SELL order on a weekly DJI chart. The results are within each code shown below:
123456789101112if not onmarket thenbuy 1 contract at marketendifif onmarket thensell at marketendifcount = count + 1graph count//Results = 1265 trades and count = 2531123456789101112if onmarket thensell at marketendifif not onmarket thenbuy 1 contract at marketendifcount = count + 1graph count//Results = 1265 trades and count = 253112345678910if onmarket thensell at marketendifbuy 1 contract at marketcount = count + 1graph count//Results = 0 trades and count = 2531 (it opened 1 trade and never closed it)12345678910buy 1 contract at marketif onmarket thensell at marketendifcount = count + 1graph count//Results = 1265 trades and count = 2531So it appears that it is impossible to actually physically sell at the close of a bar and open a new position at the same time as PRT just lets one instruction cancel out the other. If you use ONMARKET and NOT ONMARKET then you get a trade only every other bar. This means that our strategies are missing 50% of the market.
We have to use ONMARKET with our SELL instruction otherwise we get no trades!
Am I missing something or is it impossible to close a trade and open a trade on the same bar opening? This might explain why some people complain of different performance in back testing compared to forward testing – because if your start bar is one bar different you get different results.
08/03/2018 at 11:22 AM #77460In my tests the line
1buy 1 contract at marketon Eur/Usd, 30 minutes, correctly opens one new trade each bar (48 trades in a day), without closing them, on ProBackTest, while on DEMO it only opens the first trade and NO MORE!
I clicked on Help to send an assistance request (I posted it on the Italian forum), authorized decoding my strategy but… IG replied they do not provide support for coding issues, without telling me WHO is in charge of those issues. Oddly enough, if IG does not support coding issues, why the Help menu sends them such requests, instead of sending them elsewhere?
Anyway, since yesterday morning I had no further reply by Email, nor from PRT on this forum!
-
AuthorPosts
Find exclusive trading pro-tools on