Export to Excel in Real Time
Page 1 of 732 12 LastLast
Results 1 to 10 of 319

Thread: Export to Excel in Real Time

  1. #1
    I use DDE library provided by Windows. No custom / dll that is proprietary.

    The process will be as follow:

    1. Initialize DDE
    2. Create series handle for Excel Appliion (in DDE term, it's known as SERVICE)
    3. Create series handle for Sheet title (TOPIC)
    4.) Connect to Sheet
    5. Free the above handles, they won't be used anymore
    6. Create series handle for cell (ITEM) using cell address in R1C1 style
    7. Send the information
    8. To export information to a different cell, replie 6-7
    9. You can reuse the created items' handle (in case you want to update the cells frequently)
    10. Before program return, free all items' string handle
    11. Disconnect Excel and sheet
    12. Uninitialize DDE

    Make Certain to enable Allow DLL imports in Expert Advisor configurations.
    You might want to disable MT4 DDE Server before running this script.

    You will find 2 files attached in this article:
    - ExcelExportLib.mq4, put this file in specialists\libraries folder. This is merely a very simple mq4 library that wrap a DDE functions.
    - ExcelExportTest.mq4, put this file in specialists\scripts folder. It is a test script that can write text on Excel Sheet 1, cell R2C2

    Cheers,

  2. #2
    Quote Originally Posted by ;
    quote Hi Serkan, I upgraded the library to the latest MT4 build. Place ExcelExportLib.ex4 into MQL4\Libraries folder. I also attached a sample script showing how to call the lib. Finest, s document file
    Hallo Sir I tried to modify https://www.forexsoutheast.asia/atta...1557218443.mq4 to get more data in Excel.
    This is my code but I get just the personality R CellAddress = R1C2:
    that I apriciate your help.
    #property copyright Copyright 2012, Stephen Ambatoding
    #property Hyperlink http://www.Forexsoutheast.asia.com/sangmane
    #property strict
    #property show_inputs
    extern string Sheet = Sheet1;
    string CellAddress ;
    string CellValue ;
    #import ExcelExportLib.ex4
    int ExcelInit(string Sheet);
    void ExcelDeinit();
    int ExcelWrite(string CellAddress, string CellValue);
    #import
    void OnStart()

    if(CellAddress = R1C2)
    string CellValue = From Indonesia with Love;

    int iRet;
    iRet = ExcelInit(Sheet);
    if (iRet == 0)

    Alert(ExcelInit failed!) ;
    return;

    iRet = ExcelWrite(CellAddress, CellValue);
    if (iRet == 0)

    Alert(ExcelWrite failed!) ;


    ExcelDeinit();
    return;

  3. #3
    That I just wanted to thank you, although MT4 isn't used by me - that I know how much work it is to place such things together.

  4. #4
    Nice work Sangmane - and - thank you.

  5. #5
    Hello, Can you please the two files? I'd like to provide this a test. Thank you very much

  6. #6
    Sangmane,

    Is it possible to export real time indior worth to a excel worksheet?
    Please re-attach the 2 files.

    Thanks and regards,

  7. #7
    Hello,

    Im attempting to use your library, unfortunatelly with no success. Also the test file doesn't work, it gives error (1) (see below).

    Am utilizing MT4 build 670 on Windows 8 and that I have the following 2 situations:

    1) when I attempt to include your library in my code I get the following error:

    Cannot loe 'ExcelInit' in 'ExcelExportLib.ex4'

    2) To solve the problem in 1) I did a KISS procedure =gt; I have copied ExcelExportLib.mq4 in my EA and called the functions right, after which I have discovered that at ExcelInit(. .) , DdeConnect(...) returns 0, whatever I try.

    Then I googled for DdeConnect plus some suggested that I should switch to the Unicode style instead of Ansi, so I changed into utilizing DdeInitializeW(. .) and DdeCreateStringHandleW(. .) But this also didn't help.


    Would you understand what's happening and how I can fix this ?

    Thanks Beforehand.

  8. #8
    Quote Originally Posted by ;
    Hi, Im trying to use your library, unfortunatelly without achievement. In addition, the test file does not work, it gives mistake (1) (see below). Im using MT4 build 670 on Windows 8 and now I have the following 2 scenarios: 1) when I attempt to add your library into my code I get the following error: can't find 'ExcelInit' in 'ExcelExportLib.ex4' two) To solve the problem in 1) I did a KISS method =gt; I've copied ExcelExportLib.mq4 within my EA and called as the functions right, and then I've discovered that in ExcelInit(. .) , DdeConnect(...) returns 0, whatever I attempt....
    Hi Serkan,

    I upgraded the library to the Most Recent MT4 build. Put ExcelExportLib.ex4 into MQL4\Libraries folder.
    I also attached a sample script showing how to call the lib.

    Best,
    s
    https://www.forexsoutheast.asia/atta...1512546714.ex4
    https://www.forexsoutheast.asia/atta...3239519258.mq4

  9. #9
    OK thx for the effort.

    I have analyzed your new files and mistake (1) doesn't seem anymore, but (2) still happens if I run your test (an alert is displayed with the message ExcelWrite neglected !) ;

    Btw, correct me if I am wrong, but the idea of your code is that you create your own DDE service that could be called from Excel or OpenOffice, right ? Like this (in OpenOffice) =DDE(EXCEL, sheet1; r1c1).

  10. #10
    Thanks so much sangmane, been searching everywhere for something like this!

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.