Emulation of ticks from an EA/indicator - page 2

 
Meat:

Your code, first of all, does not just emulate a tick, but forces the graph to update with the corresponding history at each tick. Do you even look into the log file sometimes? At your leisure, take a look and see what's going on there. And estimate what will be there in a day or so. Not to mention load on your system and Internet channel.

If instead of updating the chart in your code we emulate the tick, it will lead to loops (i.e., the indicator will start without stopping), and, accordingly, the terminal hangs.

Why do I need to update without loading history? Forced refreshing of the chart is tick emulation.

Here is the log after 2500 ticks:

00:51:32 Check_UpdateChart EURUSD,M1: loaded successfully
00:52:48 Check_UpdateChart EURUSD,M1: uninit reason 1
00:52:48 Check_UpdateChart EURUSD,M1: removed

Nothing is hanging. The emulation is made for the indicator to loop. In other words, it triggers itself.
 
Zhunko:

Why do you need to update without loading history? Forcing the graph to update is tick emulation.

Here is the log after 2500 ticks:

00:51:32 Check_UpdateChart EURUSD,M1: loaded successfully
00:52:48 Check_UpdateChart EURUSD,M1: uninit reason 1
00:52:48 Check_UpdateChart EURUSD,M1: removed

Nothing is hanging. The emulation is made for the indicator to loop. That is, it starts itself.


I thought I wrote it clearly: " log log". So why do you show me the log of experts? Apparently, I was right, you never look there. I would not be surprised if you have half of your hard drive filled with these logs :)

The history update and tick emulation are different things. Incoming ticks from the server do not update the history (i.e. previous bars). If it were happening, the terminal would be wasting a lot of traffic and resources.

Therefore, it is unclear why you need to update it on every tick, which resets IndicatorCounted() to zero, and thus requires checking the entire history on every tick. That's a lot of resources being wasted.

 
Meat:

Incoming ticks from the server do not update the history (i.e. previous bars). If they did, the terminal would eat up a lot of traffic and resources.

But what to do, if for example 1 bar = 2 ticks )))))? In my case ticks update history ?
 
IgorM:

placed after

I got it in the log:

23:39:01 test EURUSD,H1: loaded successfully
23:39:01 test EURUSD,H1: PostMsgAddr =1977398342
23:39:01 test EURUSD,H1: initialized
23:39:01 test EURUSD,H1: cycle completed....

Yeah, it's not clear what's going on... Try this then: In the import section #import"user32.dll" add a function:

CallWindowProcA(int lpPrevWndFunc[], int hWnd, int Msg, int wParam, int lParam);

And at the end of SetMyTimer function add a line: CallWindowProcA(code,0,0,0,0);

And with some parallel running indicator check if a tick is generated at this moment.

 
solar:
What if I have for example 1 bar = 2 ticks ))))) In my case ticks update the history ?
Of course the current bar is always updated, but we were talking about history in general.
 
Meat:


I wrote it clearly: "the log". So why are you showing me the Expert Advisor's log? Apparently I was right, you never look there - I'm not surprised if half of your hard drive is already stuffed with these logs :)

And don't confuse the concepts.History update and tick emulation are different things. Incoming ticks from the server do not update the history (i.e. previous bars). If they did, the terminal would eat enormous amounts of traffic and resources.

Therefore, it is unclear why you need to update it on every tick, which resets IndicatorCounted() to zero, and thus requires checking the entire history on every tick. That's a lot of resources being wasted.

The log is empty too, but for some other reason. I use the console cleaner after the history is swapped. I have my own log.

The MT4 log doesn't bother me at all. Metacquotes has repeatedly stated that logging is the last thing to be done. It is not a priority. It doesn't consume any resources. It just needs to be cleaned in time, that's all.

As for IndicatorCounted()... I don't use it. My Indicators are empty boxes to pull out information from Expert Advisor. I think it is harmful to use indicators in MT4. The interface threads are slow and they work 3 times slower than Expert Advisors.

Highlighted is of course correct, but is it worth so much bothering with separation?

Here's the log log for 415 updates:

03:00:44 Custom indicator Check_UpdateChart EURUSD,M1: loaded successfully
03:00:46 HistoryCenter: synchronize 'EURUSD1
03:00:46 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:47 HistoryCenter: synchronize 'EURUSD1'
03:00:47 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:47 HistoryCenter: synchronize 'EURUSD1'
03:00:47 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:48 HistoryCenter: synchronize 'EURUSD1'
03:00:48 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:48 HistoryCenter: synchronize 'EURUSD1'
03:00:49 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:49 HistoryCenter: synchronize 'EURUSD1'
03:00:49 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:50 HistoryCenter: synchronize 'EURUSD1'
03:00:50 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:51 HistoryCenter: synchronize 'EURUSD1'
03:00:51 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:51 HistoryCenter: synchronize 'EURUSD1'
03:00:52 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:52 HistoryCenter: synchronize 'EURUSD1'
03:00:55 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:55 HistoryCenter: synchronize 'EURUSD1'
03:00:55 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:55 HistoryCenter: synchronize 'EURUSD1'
03:00:55 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:55 HistoryCenter: synchronize 'EURUSD1'
03:00:56 HistoryCenter: 2 bars imported in 'EURUSD1'
03:00:56 HistoryCenter: synchronize 'EURUSD1'
03:00:57 Custom indicator Check_UpdateChart EURUSD,M1: removed
03:00:59 HistoryCenter: 2 bars imported in 'EURUSD1'
03:01:01 MetaTrader build 438 stopped

Doesn't seem to matter to me for testing the performance of the indicator over the weekend. The log can be cleaned manually after work.

But it is easier to insert one line of code at the end of start() than to insert your code. There is no sense in complicating it.

 

I have XP - it seems to work - then it crashes the terminal ....

Whether in the indicator code - or in the EA code - or by itself - the result is the same - the terminal crashes after about 15 - 50 seconds ...

So you have something wrong...

but it's not a bad idea ...

 

Is there any way to make it similar for an indicator?

Simply by pointing the cursor to the point in time where I want to see the indicator reading (at that point)?

 

Zhunko, well, if everything is non-standard (your own log, your own implementation of indicators, etc.), then why are you starting this whole conversation? We are actually discussing the work specifically with MT4, not with our own developments.

In my first post I specifically pointed out that my code will be useful if the task is to do without external links, ie, to implement a self-sufficient Expert Advisor/indicator that uses only system libraries. And if you are using your own developments, then it's not applicable to you.

And in general, I do not understand why I have to "manually clean the log after work", if it's easier not to clutter it up. After all, as far as I understood, you implement your developments in DLL. Then what prevents you from setting the same timer there, as I suggested here. But for some reason you prefer all sorts of dances with tambourine and cleaning the log. My code bothers you, while you're too lazy to clean the log every day :)

 
elmucon:

I have XP - it seems to work - then it crashes the terminal ....

Whether in the indicator code - or in the EA code - or by itself - the result is the same - the terminal crashes after about 15 - 50 seconds ...

So you have something wrong...

but it's not a bad idea ...


Yeah, maybe it's a bit of a stretch. I'm not much of an assembler expert, so don't judge me too harshly :) I'll try to figure out what the problem is.
Reason: