How do I reduce calculation time?
Forums › ProRealTime English forum › ProBuilder support › How do I reduce calculation time?
- This topic has 7 replies, 3 voices, and was last updated 5 years ago by Grantx.
-
-
03/14/2019 at 3:18 PM #9364203/14/2019 at 3:22 PM #93644
https://www.prorealcode.com/documentation/calculateonlastbars/
1 user thanked author for this post.
03/14/2019 at 5:18 PM #93670https://www.prorealcode.com/documentation/calculateonlastbars/
Thanks for the answer. What if I only want to start calculating from the start of the day? That code specifies 200 bars but there might be more in my day profile.
Thanks.
03/14/2019 at 9:55 PM #93709Maybe if you can provide a link to where I can find the code for the indicator in the library or the actual code of the indicator then it might be easier to see if your request is possible. It might be possible using MTF and GRAPHONPRICE using a dummy strategy but without the code it is difficult to be certain.
The other option is to work out how many candles there are in a day for the time frame that you use and then only load the indicator for that number of bars so you have the last 24 hours only. As I don’t know the workings of the indicator or what time frame you use it on it is not possible to know if this will actually work or give accurate results.
03/15/2019 at 9:57 AM #93744Here is the code. I’m still learning so please excuse the poor coding skills.
I basically pull statistics from a SQL database and then hard code them into the indicator (which I will update weekly.)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960//PRC_TSR_DailyRange_display | indicator//11.12.2018//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge//translated from MT4 versiondefparam drawonlastbaronly=trueif day<>day[1] thenstartbar=barindexendifHIDaily1 = dhigh(0)LOWDaily1 =dlow(0)TodayRange=dhigh(0)-dlow(0)if(Open[0]> 8000 AND Open[0]< 14000) THEN //DAXavr = 126averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +5tickbufferdown = +5ELSIF(Open[0]> 18000 AND Open[0]< 30000) THEN //YM Wall Streetavr = 300averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +6tickbufferdown = +6ELSIF(Open[0]> 1000 AND Open[0]< 4000) THEN //SP500avr = 30averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +2tickbufferdown = +2ELSIF(Open[0]> 5000 AND Open[0]< 10000) THEN //nasdaqavr = 103averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +2tickbufferdown = +2ELSEresult = resultENDIF//Line segmentsdrawsegment(startbar,averagerangedown,barindex,averagerangedown) coloured(124,252,0)drawsegment(startbar,averagerangeup,barindex,averagerangeup) coloured(124,252,0)drawsegment(startbar,HIDaily1,barindex,HIDaily1) coloured(124,252,0)drawsegment(startbar,LOWDaily1,barindex,LOWDaily1) coloured(124,252,0)//Text on chartdrawtext("Range #TodayRange#",barindex,LOWDaily1-tickbufferdown,Dialog,Bold,14) coloured(124,252,0)drawtext("Average range #avr#",barindex,averagerangedown - tickbufferdown,Dialog,Bold,14) coloured(124,252,0)drawtext("Average range #avr#",barindex,averagerangeup + tickbufferup,Dialog,Bold,14) coloured(124,252,0)RETURN03/15/2019 at 10:54 AM #93771To be honest with you it isn’t what I would call a slow to draw indicator in the first place! However try this little modification that speeds it up a little:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859//PRC_TSR_DailyRange_display | indicator//11.12.2018//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge//translated from MT4 versiondefparam drawonlastbaronly=trueif day<>day[1] thenstartbar=barindexendifif date = today[0] thenHIDaily1 = dhigh(0)LOWDaily1 =dlow(0)TodayRange=dhigh(0)-dlow(0)if(Open[0]> 8000 AND Open[0]< 14000) THEN //DAXavr = 126averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +5tickbufferdown = +5ELSIF(Open[0]> 18000 AND Open[0]< 30000) THEN //YM Wall Streetavr = 300averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +6tickbufferdown = +6ELSIF(Open[0]> 1000 AND Open[0]< 4000) THEN //SP500avr = 30averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +2tickbufferdown = +2ELSIF(Open[0]> 5000 AND Open[0]< 10000) THEN //nasdaqavr = 103averagerangedown = HIDaily1 - avraveragerangeup = LOWDaily1 + avrtickbufferup = +2tickbufferdown = +2ELSEresult = resultENDIF//Line segmentsdrawsegment(startbar,averagerangedown,barindex,averagerangedown) coloured(124,252,0)drawsegment(startbar,averagerangeup,barindex,averagerangeup) coloured(124,252,0)drawsegment(startbar,HIDaily1,barindex,HIDaily1) coloured(124,252,0)drawsegment(startbar,LOWDaily1,barindex,LOWDaily1) coloured(124,252,0)//Text on chartdrawtext("Range #TodayRange#",barindex,LOWDaily1-tickbufferdown,Dialog,Bold,14) coloured(124,252,0)drawtext("Average range #avr#",barindex,averagerangedown - tickbufferdown,Dialog,Bold,14) coloured(124,252,0)drawtext("Average range #avr#",barindex,averagerangeup + tickbufferup,Dialog,Bold,14) coloured(124,252,0)endifRETURN1 user thanked author for this post.
03/15/2019 at 11:43 AM #93778@Grantx are you doing a load of other stuff (games maybe?) on your PC at the same time as you get the Caculating message?
If Yes or I could be, then maybe not enough CPU power left to do a fast Calc (without screen message) while loading Indicators??
Just thoughts / ideas anyway.
03/15/2019 at 5:46 PM #93818 -
AuthorPosts
Find exclusive trading pro-tools on