Indicators: HTF_Reversal_Divergences

 

HTF_Reversal_Divergences:

A multi_timeframe indicator which features RSI divergence. + Buy/Sell signals Inspired from trading view.

HTF_Reversal_Divergences

Author: Hammad Dilber

 

Nice one! Traders can definitely grab some pips with this indicator's entry signals.👍

I did, however, get this error in the Experts tab. (I had 2 other charts and 2 EA's running in the same terminal, so... )

error

 
Ryan L Johnson #:

Nice one! Traders can definitely grab some pips with this indicator's entry signals.👍

I did, however, get this error in the Experts tab. (I had 2 other charts and 2 EA's running in the same terminal, so... )


Thanks for sharing the screenshot! This error appears because your terminal was running 2 EAs and multiple charts at the same time, which caused high CPU load on your PC. The indicator itself is fine. Please try running it on a fresh chart without other EAs running and see if the error goes away. Let me know if it still shows!
 
Hammad Dilber #:
Thanks for sharing the screenshot!

Thank you for your prompt reply. Here are some more screenshots:

CPU

test

Hammad Dilber #:
This error appears because your terminal was running 2 EAs and multiple charts at the same time, which caused high CPU load on your PC.

The screenshot of the CPU load for the PC on which I ran the indicator is attached. While the PC is not exactly state-of-the-art, it can handle many applications simultaneously without burdening its CPU. Therefore, I'm fairly certain that the issue resides somewhere within MT5 and not within Windows nor hardware limitations.

Hammad Dilber #:
The indicator itself is fine.

The screenshot of the MT5 Experts tab shows some Print() testing using TimeLocal() at:

  1. the start of OnInit(),
  2. completion of OnInit(),
  3. the start of the first run of OnCalculate(), and
  4. completion of the first of OnCalculate().
Excluding any milliseconds, the first run of OnCalculate() took 3 seconds. Indeed, this is how long it took for the indicator's buffer and objects to appear on the chart.

Hammad Dilber #:
Please try running it on a fresh chart without other EAs running and see if the error goes away.

The above test was run with no other code loaded into MT5 and the market was closed.

I've coded my fair share of indicators that draw buffers and/or objects, and the ones that draw many objects (especially frequently updating objects) are most burdensome on MT5. I'm not saying that the charts and EA's that I previously ran along with your indicator had no effect on the issue but in my experience, MT5 is pretty good at identifying the slowest running program that triggers the stop flag─and the 3 second single run time (pictured above) is likely not a coincidence.

FYI... I wouldn't be droning-on here if I weren't so interested in using your indicator.

 
حەمەد دڵبەر وێنەی # :
سوپاس بۆ بڵاوکردنەوەی شاشە! ئەم بارەی لە هەڵەکردن تێرمیناڵەکەت یەک کات ٢ EA و چەندین جار هێڵداکاریا، پێشکەوتنی سی پی یو کۆمپیوتەرەکەت. خودی نیشاندەرەکە باشە. تکایە هێڵکارییەکی تازە جێبەجێی بکەن بەبێ ئەوەی EA ەکانی تر کاربکەن و بزانە هەڵەکە نێت نێت یان نا. نیشانە دەدات ئاگادارم بکەر ئەگەر ئەگەر!
سpas boblaw krdnawae shasha
 
henar #:
سpas boblaw krdnawae shasha

Please translate to English at DeepL Translate: The world's most accurate translator

Thanks.

 

The bulk of the issue is in the UpdateHTFData() custom function which runs on every tick and contians CopyRates(), multiple loops, and many arrays.

test_2

 
Ryan L Johnson #:

The bulk of the issue is in the UpdateHTFData() custom function which runs on every tick and contians CopyRates(), multiple loops, and many arrays.


Thank you for the detailed testing and the screenshots. You are right, the 3 second delay is coming from the UpdateHTFData() function since it runs on every tick and contains CopyRates(), multiple loops and arrays. I will optimize it to run only on new bar instead of every tick. Will share the updated version soon.
 
Hammad Dilber #:
Thank you for the detailed testing and the screenshots. You are right, the 3 second delay is coming from the UpdateHTFData() function since it runs on every tick and contains CopyRates(), multiple loops and arrays. I will optimize it to run only on new bar instead of every tick. Will share the updated version soon.

Fantastic!

Thank you.

 
The initial version could not run with EA because it was very heavy. I tried to help fix it so that it could run with EA and not use more CPU memory.
 
Dwi Anto #:
The initial version could not run with EA because it was very heavy. I tried to help fix it so that it could run with EA and not use more CPU memory.

This is a known issue. The developer is already working on a fix:

Forum on trading, automated trading systems and testing trading strategies

Indicators: HTF_Reversal_Divergences

Hammad Dilber, 2026.04.13 06:30

Thank you for the detailed testing and the screenshots. You are right, the 3 second delay is coming from the UpdateHTFData() function since it runs on every tick and contains CopyRates(), multiple loops and arrays. I will optimize it to run only on new bar instead of every tick. Will share the updated version soon.