Indicators: iForexSessions - page 2

 

Constant high load on the CPU core.


 

The visualization of trading sessions is almost invisible.


 
fxsaber #:

Constant high load on the CPU core.


Low CPU load on my system with the indicator loaded on 4 charts:

I also tried increasing "Number of days to display" from default 35 to 100 on the 4 charts, switching timeframes frequently, yet the CPU load is low.

I also tried resizing the y (price) axis and  zooming in/out to test "CHARTEVENT_CHART_CHANGE" event and yet CPU usage does not exceed 1%.

Edit:

I used the Profiler and compiled the indicator with/without optimizations -> I failed to spot major bottlenecks in the code

 
fxsaber #:

Incorrectly determined the time offset.


I tried this code.


Result.

I would be grateful if you find a broker with weird configuration of the chart bars thus giving wrong GMT offset.

 
fxsaber #:

The visualization of trading sessions is almost invisible.


It is a MT5 issue, just resize the price axis by holding down the left mouse button and drag down.


Edit: click the image frame above to show
 
amrali #:

Low CPU load on my system with the indicator loaded on 4 charts:

Try RannForex-Server.
2024.03.30 19:28:34.579 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:34.579 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:34.579 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:35.551 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:35.551 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:35.551 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:36.554 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:36.554 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history
2024.03.30 19:28:36.554 iForexSessions (XAUUSD,M1)      >> CTimeZoneInfo::HistoryBrokerOffset() FAILED: The requested date 2024.03.24 is not found in the available history


#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
{
  if(!iTime(NULL, PERIOD_H1, 0))
    ChartSetSymbolPeriod(0, NULL, _Period); // emulate a tick
    
   return(0);
}
 
amrali #:

It is a MT5 issue, just resize the price axis by holding down the left mouse button and drag down.

It's probably better to make a solution that doesn't require these steps.
 
fxsaber #:
Try RannForex-Server.


I already tried 6 other servers in addition to RannForex. Low CPU load on all servers.
1. ICMarkets
2. OctaForex
3. AdmiralMarkets
4. Exness
5. XMGlobal
6. RannForex
When I am on my PC, I will re try with your sample code.
 
fxsaber #:
Try RannForex-Server.


negligible CPU load.


My PC specs:

RannForex MetaTrader 5 x64 build 4260 started for RannForex Limited

Windows 11 build 22631, 24 x 13th Gen Intel Core i7-13700KF, AVX2, 24 / 31 Gb memory, 130 / 199 Gb disk, UAC, GMT+3


 

Update 31 March 2024 - version 1.35

Fixed failed calculation of broker GMT offset when the terminal is started with the indicator is already attached to a chart (bug reported by @fxsaber).

Reason: