Don’t want sundays to be shorn/counted
Forums › ProRealTime English forum › ProRealTime platform support › Don’t want sundays to be shorn/counted
- This topic has 6 replies, 3 voices, and was last updated 14 hours ago by dubbzie.
-
-
01/27/2025 at 7:05 PM #243133
Hi,
Not sure if this has been posted in the right place?
I am trading US Tech1 100 CFD with automated strategies using ProRealTime on the web. The issue is: Sundays are appearing and included in the calculation of indicators, and trades can be made on Monday at 01:00 based on Sunday’s calculations. I only want Monday through Friday to be included… Is there anything I can do to achieve that?
01/27/2025 at 8:11 PM #243135I’ve run into this same issue and found the best approach is to adjust the code so Sundays are completely ignored. For example:
IF OpenDayOfWeek > 0 AND OpenDayOfWeek < 6 THEN
// Your trading conditions and execution logic here
ENDIF
You’ll also need to modify any indicators that span multiple days. For instance, for a 200-period moving average, you’d adjust to account for extra Sunday bars (e.g., use
Average[240]
instead ofAverage[200]
when working with daily charts).It’s safer and more robust to handle this in your code rather than rely on a workaround that depends on compatibility between ProRealTime and your broker. I also find it frustrating to see a daily bar for Sunday on platforms like IG when the market has only been open for a couple of hours. It throws off both visual analysis and indicator calculations.
If anyone else has tips or alternative solutions, I’d love to hear them!
3 users thanked author for this post.
01/28/2025 at 11:44 AM #243156Thank you very much. It solves how not to trade on Sunday, but how to remove Sundays from, for example, RSI calculations? Any suggestions? It’s strange that on the IG App sundayg are remowed, but not in the ProRealCode web-solution. If it would be possible to use data from IG App or IG web platform, the problem would be solved.
01/28/2025 at 4:57 PM #243161Based on this indicator of mine at https://www.prorealcode.com/prorealtime-indicators/time-range-moving-averages-simple-exponential-weighted-trsma-trema-trwma/, I modiefied the TREMA to adapt it to days of the week, instead of times (but the two solutions could be easily combined):
1234567891011121314151617181920// DayOfWeek EXPONENTIAL MOVING AVERAGE//Periods = 20//Alpha = 2 / (Periods + 1)i = 0dowEMA = closeFOR j = 0 TO 3000IF OpenDayOfWeek[j] >= 1 AND OpenDayOfWeek[j] <= 5 THENi = i + 1dowEMA = ((close[j] - dowEMA) * Alpha) + dowEMAIF i = Periods THENBREAKENDIFENDIFNEXTIF dowEMA = 0 THENdowEMA = closeENDIFReturn dowEMA AS "dowEMA"There’s no way to have default indicators adapted. Each desired indicator of which the source code (or at least its formula) is known coud be tested and probably adapted, but this ios not 100% guaranteed and is for sure time consuming.
01/29/2025 at 8:44 AM #24316801/29/2025 at 5:17 PM #24318901/29/2025 at 6:46 PM #243196 -
AuthorPosts