Emulation of ticks from an EA/indicator - page 4

 
Zhunko:

Just one case for example?

Just take my ChartBuilder in the codebase. It can use a large number of trading instruments. And if for the instrument, on which it hangs, no new ticks are received for some time, the value shown is already irrelevant (outdated).

As for the Expert Advisor+indicator combination, if you mean to transfer the code to the Expert Advisor to reduce the load on the main thread, it seems more reasonable to port the code to a DLL and import it into the indicator. If you think about porting the code, it should be in a normal environment.

 
Meat: I figured out what was the problem: the array has to be declared on the global level, not on the local one.

no ticks.... ((((

log:

18:33:34 test EURUSD,H1: loaded successfully
18:33:36 test EURUSD,H1: initialized

right mouse button "refresh graph" the comment was tick: 1, became tick: 2

no errors in the log

SZS: cut the interconnection by checking "enable proxy server" , restarted the terminal - no connection , but when I checked the checkbox. SZY: shut down the intercom by ticking "enable proxy server" , restarted the terminal - no connection, but when you removed the checkbox about the proxy server, how "started" ..... ;)

 
As an idea - a separate Exe, finds the MT window - scrolls through the windows within it
and starts sending them tick emulation at a set interval.
 
jartmailru:
As an idea - a separate Exe, finds the MT window - scrolls inside it windows
and starts to send them emulation ticks.
I have one just like it. Only in DLL. But Alexey wants it without third-party DLLs and EXEs.
Meat:

1. Take my ChartBuilder in the codebase, for example. It can use a large number of trading instruments. And if for the instrument, on which it hangs, no new ticks come for some time, then the displayed value is already irrelevant (outdated).

2. As for the Expert Advisor+indicator, if you mean to transfer the code to the Expert Advisor to reduce the load on the main thread, it would be more reasonable to move the code to a DLL and import it into the indicator. If you want to bother with porting the code, you'd better at least do it in a good environment.

1. I will repeat it once again. If you want to react to the tool outside the current window, you should use the server's time. The WinAPI is not needed for that. MQL4 has such a function.

2. It does not matter which binding is used. This is the same solution. A looped Expert Advisor responds to changed server time. This is enough to solve all problems you are trying to solve.

You only need to emulate ticks to start the Expert Advisor at the weekend. It is not required for anything else. I have shown how to update the indicator. Just one line.

=====================

The latest version of indicator does not work on Windows 7.


 
IgorM:

no ticks.... ((((

...............

SZS: cut the interconnect by checking "allow proxy server" box. But when I unchecked the proxy checkbox, it just "clicked off" ..... ;)

Igor, this way of disconnecting from the Internet is not good. There are a lot of things that do not work in this mode. It is not necessary to disable access to the Internet.

For example, this code for Expert Advisor:

#include <WinUser32.mqh


void init()
 {
  int hwndChart = WindowHandle(Symbol(), 0);
  int nNewMessageWindow = RegisterWindowMessageA("MetaTrader4_Internal_Message");
  for (int i = 0; i < 200; i++) PostMessageA(hwndChart, nNewMessageWindow, 2, 1);
 }

void start()
 {
  int nCounter = 0;
  while (!IsStopped())
   {
    nCounter++;
    Comment(nCounter);
    Sleep(500);
   }
 }

works on weekends and when there are no ticks, but it does not work when disconnected from the internet. There is some obscure peculiarity there.

Perhaps, they have optimized it in the latest builds. It used to work earlier.

You'd better choose a tool that is rarely updated.

 
Zhunko:
I have one of those made. Only in DLL. But Alexey wants it without third-party DLL and EXE.

1. Once again. To react to a tool not from the current window, you need to use server time. The WinAPI is not needed for this. MQL4 has such a function.

2. It does not matter which binding is used. This is the same solution. A looped Expert Advisor responds to changed server time. This is enough to solve all problems you are trying to solve.

You only need to emulate ticks to start the Expert Advisor at the weekend. It is not required for anything else. I have shown how to update the indicator. Just one line.

=====================

This last indicator does not work on Windows 7.


I do not understand what you are trying to prove, that several running files are cooler than one? Of course, I can run a looped Expert Advisor, but I do not see the point in making this mess out of two working files, when I can do the same thing in the indicator itself or in a connected dll. Of course, I understand that you prefer to have several different programs running, and each program performs its specialized function: one cleans logs, another sends tics, etc. But your approach is not the only one correct.

Emulating ticks is only necessary to start the Expert Advisor at the weekend

I repeat, you are wrong. The need for ticks does not depend on the day of the week. I've already explained why. If you don't trade yourself, but believe me, I've been trading futures for the last few years, you have to update ticks there quite often.

 

There's an assumption that the code doesn't work where 64-bit is installed. I just have 32, so I can't check it. Try to insert four null bytes after PostMsgAddr there (not forgetting to increase the array size). Maybe it will work... Although I guess you must make the other two parameters 64-bit too... or not?... Anyway, I haven't worked in a 64-bit environment yet, so I don't know.

 
Meat:


1. I don't understand, what are you trying to prove to me? That several running files are cooler than one? Of course, I can start a looped Expert Advisor, but there is no sense to create such a mess consisting of two working files, when I can do the same things in indicator itself or in a linked dll. Of course, I understand that you prefer to have several different programs running and each one is performing its specialized function: one cleans logs, the other sends ticks etc. But only your approach is not the only correct one.

2. Again, you are wrong. The need for ticks does not depend on the day of the week. I have already explained why. Unless you are a trader yourself, but believe me, I have been trading futures for the last few years, it is often necessary to update ticks there.

1. Now I don't understand... Where did I say what is cooler? I've already reiterated many times that tick emulation is not necessary for trading. It's only needed for weekend debugging when there are no ticks.

2. How do you trade from an indicator? MQL4 does not provide it. You need an Expert Advisor or a script. The Expert Advisor loops and compares the server time with the previous one. If there is a mismatch, you react in the manner prescribed by the TS. That is all! There is no need for any emulation. What are you proving? I have already written it in several versions in various posts. You have to run such an Expert Advisor at weekend to debug it. I wrote the code above.

 
Zhunko:

1. Now I don't understand... Where did I say what is cooler? I've already reiterated many times that tick emulation is not required for trading. It's only needed for weekend debugging when there are no ticks.

2. How do you trade from an indicator? MQL4 does not provide it. You need an Expert Advisor or a script. The Expert Advisor loops and compares the server time with the previous one. If there is a mismatch, you react in the manner prescribed by the TS. That is all! There is no need for any emulation. What are you proving? I have already written it in several versions in various posts. You have to run such an Expert Advisor at weekend to debug it. I wrote the code above.

But those who trade probably know better, don't you think?

I do not want to trade from an indicator, and I do not need an additional thing in the form of a looped Expert Advisor when the ticking indicator is quite enough.

 
Meat:

So I'm saying: if you don't have any trading, then you personally don't need this emulation. But those who do trade probably know better, don't you think?

I do not want to trade from an indicator, and I do not need an additional thing in the form of a looped Expert Advisor if the ticking indicator is quite enough.

How do you trade using a ticking indicator? MQL4 does not provide for that.

Really! Why do I need an additional set of the ticking indicator that cannot trade, if I can do everything in a looped Expert Advisor? There will be no need in WinAPI, MT4 interface will not become sluggish, the Expert Advisor will operate 3 times faster. Why complicate things so much?

Reason: