in Search

Writing Alerts to a Text file with MDK ??

Last post 06-14-2006, 22:17 by hayseed. 4 replies.
Sort Posts: Previous Next
  •  01-24-2006, 19:38 14240

    Writing Alerts to a Text file with MDK ??

    In the faq online it says "alerts can be written to a text file if you have developers kit"
    Is there any suggestion on how to achieve this task via possibly MSX function calls ?
    Looks like MSX is more like custom formula fuction calls, and MSFL is for reading the security price data . Any suggestions ?

    Michael
  •  01-24-2006, 21:19 14245 in reply to 14240

    Re: Writing Alerts to a Text file with MDK ??

    Hi Michael,

    this is a simple C++ task and has nothing to do with MSX

    incomplete Sample Code

    ...

    LPSTR l_pszFileName = (LPSTR)(l_szFileName);
    //create Output File
    HANDLE hFile = CreateFile(l_pszFileName,GENERIC_WRITE,0,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);

    // Output File is generated
    if(hFile != INVALID_HANDLE_VALUE)
    {
    CloseHandle(hFile);
    FILE *l_pszResultFile;
    l_pszResultFile = fopen(l_pszFileName,"w+");

    ....
    // Now you can add all information to the file, maybe something like this
    char buffer[1000];
    p = sprintf( buffer,"%s\\n", var1);
    p += sprintf( buffer + p,"%s\\n", var2);
    p += sprintf( buffer + p, "%5d", var3 );

    // add your text to the file
    fputs(buffer,l_pszResultFile);

    ....

    // close the file
    fclose(l_pszResultFile);

    // if you like, you can open this file in Notepad with this call
    ShellExecute(NULL, "open", "notepad.exe", l_pszFileName, NULL, SW_SHOW);


    Ok? :D
  •  01-25-2006, 20:46 14290 in reply to 14240

    Re: Writing Alerts to a Text file with MDK ??

    Hi Chris,

    Thanks for your reply.
    I guess I should re-ask the question little later after I reviewed and implemented the
    code to see if there is any obstacle for not calling file functions from MSX.
    At the same time, any suggestion for the topic from already implemented example will be appreciated.

    thx,

    Michael
  •  06-14-2006, 21:24 18167 in reply to 14240

    writing alerts to a text file with mdk ??

    Hi Chris,

    I am in the process of writing a DLL that writes alerts to a SQL database. And by alerts I mean all of the information required in the security such as symbol, datetime bar, close, periodicity, interval, alert type (custom), alert value (custom). I am writing a VB.NET application to monitor this table and automate trades via a trading rules engine... this includes email/sms to key traders within our company.

    Metastock has some 'less than efficient' features that make this a challenge, but Im almost there. If you want to do anything useful with the actual alerts I would suggest that you write to a database rather than text file as pulling data out of a database table is a lot friendler and faster than a text file.

    Jeremy
  •  06-14-2006, 22:17 18168 in reply to 14240

    texed alerts

    hey micheal...... not completely sure of your goal here..... if you consider email as text, metastock alerts themselves can send text, its an option on the alert....... the alerts 'texted' message can be sent to any email address..... text pagers also.....


    again, not sure of your goal so those methods might be of no value to you...... the drawback is, multiple text messages will be sent if the alert bounces..... often they do.....h
View as RSS news feed in XML