MT4 Offline chart not updating Custom Indicator - page 3

 
cherno99:
Just came to my mind how this used to work in the Strategy tester: when I was using the indicator I attached in my previous post I would set the indicator parameter LiveUpdateMultipleChartsto false. In doing so the code would call the function UpdateChartWindow() instead of UpdateMultipleChartWindows(). The latter had an issue with using the GetWindowHandle too frequently, locking up MT4 while the first one would just get the window handle once, keeping this in a static variable.

I tested this out on my other computer today, where I still have an MT4 build 509 and things still work perfectly how they used to. But, silly me, I never thought of using this indicator compiled with MetaEditor build 509 on my MT4 build 600+. And YES, while the newer/adapted versions of P4L PeriodCon "fail" in the strategy tester, this one still does the job updating my offline chart. And if I need more than one (un)usual timeframe, I attach the indicator a second time with another setting for PeriodMultiplier and here too setting LiveUpdateMultipleChartsto false.

I don't know what has changed in the newer versions, that's why I was asking for the mq4-file, but I suppose these are not available?

Edit: I have tested this only in visual mode so far. Before adding the indicator lower the strategy tester speed, customize the indicator settings, open the offline chart via "File --> Open Offline". After doing this you can speed up but do not go faster than 31 !

cherno99

Finding a window handle in a normal processing takes a millisecond

Keeping it (the handle) in a static variable (global variable visible to the procedure/function it is used from only) does not make any difference. The thing is that metatrader when compiling with new metatrader treats dll call differently than the build 509 did (I guess that they are doing it in order to avoid hacking) and that new, "improved" compiler produces ex4 files that do not work the same way as before. Do not expect that same things will be possible to d as we used to do from metatrader 509 and earlier. New metatrader 4 is afar, far from being at the stage that build 509 was.

Even when exactly the same window update procedure is used, it does nothing - it does not freeze the terminal but does not update the produced offline chart - tested and it simply does not do what it should do. And even when ansi dll calls are replaced with unicode dll calls (that is the official instruction that came from stringo - the head developer of metatrader), still nothing happens - the offline chart does not receive generated ticks(which were never there in the first place as far as the original code is concerned in the UpdateChartWindow()procedure - that procedure never generated ticks for offline chart, it only generated window update event)

So, until metatrader cleans the things they have made recently up, do not expect it to work as it could

 

one solution I found ( for the moment) is to rename PeriodConverter.mq4 to each time frame you want and then compile each new version , It seems that if you want more than one period at the same time PeriodConverter.mq4 packs a sulk and will only update the latest time period it loaded.

I am in version 4 build 745, I am trying 5 different time frames , they work ( for the time moment ) but the terminal is getting very slow

I may have solved the issue by increasing window refresh time to 5 seconds for the 10 + 20 min chart

//--- refresh window not frequently than 1 time in 2 seconds

if(hwnd!=0 && cur_time-last_time>=5), time will tell if this works , I suspect it would be better if this were an EA to avoid any reloading issues if terminal were closed . any other ideas ?

 

have tried to attach a renamed period v=converter version to 20min, if this works , it is attached[CHARGE][/CHARGE]

 
iamfree:
have tried to attach a renamed period v=converter version to 20min, if this works , it is attached(Purchasable content)

Those are scripts

Better to use indicators (sleep(50) will sure slow down the rest of terminal execution - why not updating only on new ticks?)

Reason: