Deleting 2 Hour Sunday Bars from IBFX Daily Charts Using MQL Code

 

Hello,

I need to delete some bad data from daily chart. Some history center functions needed to be coded in mql.

Ibfx opens a wrong bar for sundays, a day bar with 2 hour data, disturbing daily charts and producing dirty signals.

I need to remove these bars, using my trading expert. Without disturbing loaded indicators on daily data?

Any coding idea?

I'm plannig to open EURUSD1440.hst and shifting up non-sunday valid records. Than how can I delete rest of useless records at the end of file? (There will be indicators already loaded on daily data while this process works) And do I need to update hst file headers to warn the system about record count change?

WithoutSunday.mq4 https://www.mql5.com/en/code/7239 (Andrey Khatimlianskyi, komposter) this code uses a seperate output file, but I want to delete in place, on EURUSD1440 system file, to be able to refresh pre-loaded daily indicators.

(If a sperate file is must, WS_EURUSD1440 here, how can I force to refresh expert loaded indicators on this data when new tick or bar comes?)

Msg 33324 is sent in the code for chart refresh. PostMessageA( hwnd[curChart], WM_COMMAND, 33324, 0 );

I need to refresh indicators, loaded by expert, on an off-line non-system data file, in this case...

Alternative idea: I'm planning to copy records from WS_EURUSD1440 to EURUSD1140 system file, in some certain periods. I hope this will not disturb indicators loaded by expert on EURUSD1440..

----

Now, I can produce corrected EURUSD1440.hst file, but MT4 does not recognize this data change. How can I force MT4 to reload all day data in the memory, it owerrites my produced/corrected file when MT4 exe closed. And never see corrected file. Possibly I'm missing some flags on data files, or some windows messages needed. . When I delete sunday bars from history center manually, system reloads new data and refreshes indicators. I hope I will discover these messages to tell MT4 to refresh data from file... Or I set day data directly into Mt4 memory, if possible? If this fails, the remaining solution is working on a seperate day file, loading indicators on this WS_EURUSD1140.hst file, and trying to refresh these stuff with new coming ticks/bars, a dirty solution...

Thanks.

 

Thanks for the reply. These answers are valid for seperate data file and an open off-line chart window.

I'm working on an automated expert. there is no off-line chart. indicators are in memory, loaded on daily data.

- If possible, I want to delete some records from history data, as if I delete from history center, using mql expert code. Is this possible? I update EURUSD1440. hst inside expert code, but MT4 does not care this update, please tell me how to force MT4 to re-load day data from hst file? History center manual update produces this action..

- Else

- how can I load custom indicators to an off-line hst file?

- i can refresh off line data file. how can i force connected indicators to be refreshed?

I'm not a begginner. Please some deep answers. Current solution "WithoutSunday. mq4" is valid for a visual off-line chart. Does not enough for a single expert, and indicators without chart.

Thanks

 
You need to create the offline file without Sundy with non-standard name (for example EURUSD1441.hst) and update this offline chart by function PostMessageA(). Use MarketnInfo(Symbol_Name, MODE_BID) instead Bid etc.
 
Rosh:
You need to create the offline file without Sundy with non-standard name (for example EURUSD1441.hst) and update this offline chart by function PostMessageA(). Use MarketnInfo(Symbol_Name, MODE_BID) instead Bid etc.


I want to force standart "EURUSD1440.hst" and it's mirror in memory to be updated. I update physical file. But in memory old data remains.

There is NO CHART, an expert and some indicators on daily data exist, loaded in this expert.

- how can i update in-memory day data by code, physical file changes but mt4 do not care this? a special windows message to warn mt4?, from history center this is possible manually...

-if this is not possible

- how can i load custom indicators on produced data, iCustom( ?is nonstandart symbol name suitable? ) YES. IT IS OK.

- how can i refresh these indicators when new ticks/bars arrive? indicators are not on the chart. DATA REFRESHED BUT INDICATORS ARE NOT REFRESHED...

IF NON-STANDART SYMBOL CHART IS OPEN AND MSG 33324 sent to whis window, indicators loaded from expert are also refreshed. NO CHART, NO REFRESH

-if this is also not possible, I'm planning in-memory day data and in-memory recalculated/refreshed day indicators.. NO NEED. JUST KEEP OPEN CHART WS_EURUSD1440 and send msg 33324 for a new tick. this forces all iCustom ( WS_EURUSD, PERIOD_D1 ..) custom indicators to be refreshed.

Attached function produces WS_EURUSD1440.hst from in-memory day data, then I wrote records from WS_EURUSD1440.hst to EURUSD1440.hst file. After this point, how can I force MT4 to update in-memory day data from the related standart system file?

-----

SUMMARY: while your expert is running on a normal system chart:

- Produce non-standart symbol hst file, with standart period extension file here "WS_EURUSD1440.hst"

- use iCustom ( "WS_EURUSD" , PERIOD_D1 ) calls from you expert that is loaded on normal system chart). iCustom can access "WS_EURUSD1440. hst"

- keep non standart off-line produced chart open. send this window, msg 33324 for new coming ticks. this also refreshes iCustom loaded indicators.

NO PROBLEM.

thanks a lot to myself :)

Files:
temp.mq4  10 kb
Reason: