Spezifikation
The job is to optimize and fix an MQL5 multi divergence indicator originally converted from a TradingView Pinescript indicator.
Things to fix:
1. Speed - the indicator works, to an extent, but is extremely slow/resource intensive sometimes blank and unreliable compared to the performance of the TV version.
2. The divergences shown by MT5 roughly coincide to TV, but often MT5 shows more/less divergences. For the same chart, the MT5 version must show the same as TV.
3. The MT5 indicator is slow and I disable divergence line draw in the settings - however, when doing this the MT5 version displays random divergences that are not shown on the TV version. See images below. To mitigate this, I keep the divergence line setting to true but comment out the line draw command in the MQL5. I want this fixed so I can disable divergence lines in the settings but see the same divergences as TV.
The below MT5/TV charts are from the same broker with identical OHCL.
TV Indicator showing regular/hidden divergences and divergence lines:MT5 Indicator showing regular/hidden divergences and divergence lines: note that the divergence do not exactly match the TV version (requirement 2)
TV indicator showing regular/hidden divergence with divergence lines disabled in settings:
MT5 indicator showing regular/hidden divergence with divergence lines disabled in settings - note that this shows random divergences that are not on the above TV chart
(req 3) - this must be fixed so MT5 shows the same divergence as TV when divergence line draw is disabled