request & warning graph(onprice)
Forums › ProRealTime English forum › ProRealTime platform support › request & warning graph(onprice)
- This topic has 8 replies, 4 voices, and was last updated 5 years ago by Paul.
Tagged: graph, GRAPHONPRICE
-
-
03/20/2019 at 5:37 PM #94178
Request; increase the number graph & graphonprice 5 (best is 10)
Request; ability to use style function i.e. set lines to dots, so when used it doesn’t show vertical lines when market is not active and resets to zero in a backtest.
Warning;
using the graph & graphonprice are limited to max 5.
If using too many in the code, the last lines & graph are automatically not displayed.
But it has influence on the code below that too, because it seems it doesn’t gets activated in backtest!
in pictures below
used 1 graph and 6 graphonprice
last 2 gets skipped, from the profittarget (greenline) & graph (to display trade performance)
exitcode is on friday 17.30.
this part of the code is at the end of the code (but above graph); if to many lines it doesn’t gets activated and resulted in a stoploss after friday 17.30
If this code is moved straight under the buy/sellshort entries, it gets activated.
So only when using too many graph in the code it becomes unreliable!
03/20/2019 at 5:55 PM #9418203/21/2019 at 6:58 PM #94347Thanks for the response Nicolas.
I did a test to check.
12345678910111213141516if time >= 080000 and COUNTOFPOSITION < 1 and close > dopen(0) thenbuy 1 contract at marketendifif onmarket thengraphonprice dclose(1)graphonprice dclose(2)graphonprice dclose(3)graphonprice dclose(4)graphonprice dclose(5)graphonprice dclose(6)endifif time = 173000 thensell at marketendifin above code, the exit-time from 173000 is not activated !
if you make a change like
1//graphonprice dclose(6)the exit-time from 173000 is activated.
That’s reason to request an increase of the number graphonprice and the warning, because it can be quickly overlooked.
03/22/2019 at 4:08 AM #9437203/22/2019 at 7:23 AM #94375As Nicolas said – you should always put GRAPH and GRAPHONPRICE as the last lines of code. If you want them to switch to zero if not on market then use a variable in the code and graph this variable.
1234567891011121314151617181920212223if time >= 080000 and COUNTOFPOSITION < 1 and close > dopen(0) thenbuy 1 contract at marketendifif onmarket thena = dclose(1)b = dclose(2)c = dclose(3)d = dclose(4)e = dclose(5)f = dclose(6)endifif time = 173000 thensell at marketendifgraphonprice agraphonprice bgraphonprice cgraphonprice dgraphonprice egraphonprice fWhat you have found may be just a minor bug but I’m guessing that if you do what I just suggested then everything will work just fine. My platform is not open at the moment to test.
03/22/2019 at 8:42 AM #9437803/22/2019 at 2:15 PM #94403@Nicolas IG and real account.
If it’s time-exit or an indicator exit or a hard stoploss, they all get skipped in backtesting in the code above.
I found this problem, as I used a trailing stop/breakeven/stoploss/profittarget, all embedded with one or more graphonprice commands.
So that will be on the bottom from now on.
Always like to see the performance gain, that number 5 is the total of graph and graphonprice together. So that leaves only 4 to use for graphonprice which is a bit limited.
@Vonasi Thanks for the tip! I did test it but lines didn’t go to zero when there was no market position.
03/23/2019 at 4:46 PM #94505I did test it but lines didn’t go to zero when there was no market position.
Ooops sorry – one of my usual forgets. Always zero the values if you ever want them to be zero! Try this:
123456789101112131415161718192021222324252627282930if time >= 080000 and COUNTOFPOSITION < 1 and close > dopen(0) thenbuy 1 contract at marketendifa = 0b = 0c = 0d = 0e = 0f = 0if onmarket thena = dclose(1)b = dclose(2)c = dclose(3)d = dclose(4)e = dclose(5)f = dclose(6)endifif time = 173000 thensell at marketendifgraphonprice agraphonprice bgraphonprice cgraphonprice dgraphonprice egraphonprice fOnce again not tested!
1 user thanked author for this post.
03/23/2019 at 8:14 PM #94512 -
AuthorPosts