EA to collect data each millisecond , not just when Ticks occur
1 2 3

thread: EA to collect data each millisecond , not just when Ticks occur

  1. #1
    Junior Member Emilio1616's Avatar
    25

    EA to collect data each millisecond , not just when Ticks occur

    Is it possible to get information out of an EA each and every second instead of just when a tick occures? I want this to be so because the EA that I'm writing takes price data out of a few currencies and steps weather they've gone up in price or down in price, and this is not possible to do in case it only takes the information each tick as it misses the shift in data of all of the other currencies. .

    Thanks a lot

  2. #2
    Junior Member piliolo's Avatar
    29
    Inserted Code / / ** * MT4/experts/scripts/ / ticks.mq4 * ship a tick every 200 ms to the chart and all its indiors and EA until this script is removed. */ #property copyright © Bernd Kreuss #import user32.dll int PostMessageA(int hWnd,int Msg,int wParam,int lParam); int RegisterWindowMessageA(string lpString); #import int start() int hwnd=WindowHandle(Symbol(), Period()); int msg = RegisterWindowMessageA(MetaTrader4_Internal_Messag e); while(! IsStopped()) PostMessageA(hwnd, msg, 2, 1); Sleep(200); Want...
    Thank you 7bit
    simple and simple - like many Fantastic items - better to use any executable which basically does exactly the same

  3. #3
    Junior Member oxpriego82's Avatar
    27
    / / ** * MT4/experts/scripts/ / ticks.mq4 * ship a tick every 200 ms into the chart and all its indiors and EA before this script is removed. */ #property copyright Bernd Kreuss #import user32.dll int PostMessageA(int hWnd,int Msg,int wParam,int lParam); int RegisterWindowMessageA(string lpString); #import int begin () int hwnd=WindowHandle(Symbol(), Period()); int msg = RegisterWindowMessageA(MetaTrader4_Internal_Messag e); while(! IsStopped()) PostMessageA(hwnd, msg, 2, 1); Sleep(200); Need no outside software for sending ticks. Attach...
    I presume I have to join this to a OFFLINE chart right?

    Regards,

  4. #4
    Junior Member piliolo's Avatar
    29
    I have to also add that if the EA or script calls for any indiors either builtin or habit ones it's going to be sending the stale data as input into the indior function call which can return stale information too. So the copy of this indictor you see on the chart will be update normally but the ea or script will be working with obsolete information that just gets older if you donot refresh the input information.
    That is a fantastic point - I am going to have to check on that as well
    thank you about this

    from the way about your script - will you manage to place it in here?

    PS: the main ideas I was going to utilize that is to send to MT4 the ticks from dll therefore it an react faster - and I agree with you about the using refrash rates and all other stuff in case we are using the infinite loop
    Regards

  5. #5
    Junior Member gnomo96's Avatar
    23
    ...
    What ea activity happens when another tick happens;
    A. The ea is stopped from doing anything it is all up to (like calculating or comparing if() functions) and restarts in the beginning () function.
    B. drops and calms all incoming ticks till it finishes with the last one.
    C. CrapT4 does anything is on the arbitrary list.
    D. None or some of the above.
    Cheers
    And the answer is meant to be B.
    http://book.mql4.com/programm/special
    Thanks to garyfritz for tracking down a reference resource.

    cheers

  6. #6
    Junior Member gnomo96's Avatar
    23
    ...
    If you wait, I'll post the copy of this script I use later tonight.

    Keit
    Hello CockeyedCowboy, thanks to your information Look forward to a own script.

    I have a query for Keit, 7bit or any of you additional smartter compared to the average bears out there -
    What ea activity occurs when a second tick arrives;

    A. The ea is stopped from doing anything it is up to (like calculating or comparing if() functions) and restarts in the beginning () function.

    B. ignores and drops all incoming ticks until it finishes with the previous one.

    C. CrapT4 does anything is about the arbitrary list.

    D. None or any of the aforementioned.

    cheers

  7. #7
    Eronyx

    Now thats how to reply a post if you would like to know.

    If your using it to only create your indiors run by time rather than tick wise it will do the job just fine, It will NOT how ever save information in milliseconds MT dosnot automaticlly do that even if the sysyem is tirgged. It will save information dependent on the time scale of the chart, unless you plan it to perform other wise.

    Additionally, with this tick generator, just the MT window it is attached to will run tick wise, if you would like to have more then one window run tick wise you have to have the code applyed to open windows. Should you use an outside script to through ticks it create the comprehensive platform run tick wise.

    Now for the error, it comes in when you run the tick generator at an EA or script that likewise trades OR handles trades. You'll need to add some code to it for it to upgrade the EA backup of the information, Like my first article states a Script or EA utilizes another copy of information, that backup only gets updated when the EA or even Scipt ends which will not take place if you code it into a loop. You have to call the RefreshRate() function only after you have the script trigger a tick.

    Should you wate, then I will place the copy of the script I use after tonight.


    Keit

    edit... I have to also add that in case the EA or script calls any indiors either builtin or custom ones it will be sending the stale data as input into the indior function call which can return stale information too. So the copy of the indictor you see on the chart will be upgrade normally but the ea or script will be working with obsolete information that only gets older if you donot refresh the input information.

    thank you Keit for allowing me know

    from the way - what was the error you had
    would you please share with us?

    Regards

  8. #8
    Junior Member elkrest's Avatar
    11
    It's pointless to shop by millisecond. It would be a waste of resources and wouldn't provide some insight to you. The way I store data is onQuoteUpdate.
    I also shop level 2 information and that I do it on Market depth updates. In mt4 the ideal solution will be to perform tick by tick otherwise you would be doing loads of additional work. In the event the matter is because you feel that every millisecond is a sense of continuous time then after saving the information to csv run an instance that fills in for every millisecond at the previous quote untill you hit on the following quote... in a loop until file ends. It up to you my two cents

  9. #9
    Junior Member piliolo's Avatar
    29
    That quote at the base of above article is from MT, I used that same script also had a minor problem with it that you should correct, but you are going to learn.

    Keit
    thank you Keit for I want to know

    by the way - what was the error you'd
    can you please share with us?

    Regards

  10. #10
    That quote at the base of above post is from MT, I used the exact same script also had a slight problem with it that you should correct, but you are going to learn.

    Keit


    this script meets my needs - nothing else to perform
    that infinite loop on script send the ticks one per minute or how many I want to specify and also the EA can operate normally

    if there is a demand for assessing the new Bid or alternative information it can be readily done.

    I thought of it but didn't attempt another thing:

    as soon as I've some action - let us say a loop in which smth was triggered - I could end that loop with break; then send a tick message into platform then loop so it could initiate a new start() function

    what do you matter guys?

  •