Attachments forums

List of attachments posted on this forum.


All files on forums: 135911

Re: Convert MT4 indicators to MT5

trade3925, Sat Feb 18, 2023 4:58 am

I would really like someone's help with this because I am at my wits end. I tried to convert an indicator to MT5 from MT4 and have been having major issues with resource usage. The indicator extends a manually drawn rectangle to the right edge of the chart. I use this for supply and demand type trading.

The indicator works as it should when the function is called OnCalculate but when there are a lot of rectangles on the chart, the indicator can slow the chart to a crawl. Just this week I was trading CPI and the price line separated from the candle by 40 pips lol. As soon as I took the indicator off, everything returned to normal.

So I tried adding an OnTimer to call the function during a 5 second interval. That worked but as soon as I took the indicator off the chart and then put it back on, it was no longer extending the rectangles.

I have no idea where to go with this now. The indicator works perfectly fine on MT4 even with loads of rectangles on the chart. So I'm not sure why multi-threaded MT5 can't handle one instance of this.

I have attached three versions of the indicator. One is the original MT4 code, The second is the MT5 version resource hogging one. And the third is the OnTimer version where I tried to avoid the evil OnCalculate function lol.

Anyways, any guidance on how to solve the resource issue as well as get the indicator to function correctly without using OnCalculate would be greatly appreciated.
Thanks!
All files in topic