[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] AFL File operations - writing trade data to disk



PureBytes Links

Trading Reference Links




Graham
 
don't know how many times it is writes .... it 
seems to vary... maybe 6 to 20
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=gkavanagh@xxxxxxxxxxxxx 
  href="">Graham 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, December 11, 2003 2:31 
  AM
  Subject: RE: [amibroker] AFL File 
  operations - writing trade data to disk
  
  Ara, how many times is it 
  actually written?
   
   
  Cheers,Graham<A 
  href="">http://groups.msn.com/asxsharetrading<A 
  href="">http://groups.msn.com/fmsaustralia 
  
  
    
    <FONT 
    face=Tahoma size=2>-----Original Message-----From: Ara Kaloustian 
    [mailto:ara1@xxxxxxxxxx] Sent: Thursday, 11 December 2003 2:13 
    PMTo: Ami-MainSubject: [amibroker] AFL File operations 
    - writing trade data to disk
    I am trying to write data to disk with trade 
    details - equity name, buy/sell, time etc.
     
    Debugging with EOD version to avoid confusion 
    with live data stream.
     
    Every time I click on a bar, the selected data 
    is written to disk correctly, but is written multiple times. See attached 
    file.
     
    Appreciate any code review ...
     
    Thanks
     
    Ara
     
    
    // File operations
    // Create text file and save all trade signals<FONT 
    size=1>
    function DiskDataSave(Trade)
    {
    fh = fopen<FONT 
    size=1>("tradesignals.txt"<FONT 
    size=1>,"a"); 
    //<FONT face="Courier New" 
    color=#008000 size=1>open file<FONT 
    color=#800000 size=1>
    if (fh)
    {
    fputs(Trade + <FONT color=#ff00ff 
    size=1>"\n",fh); <FONT color=#008000 
    size=1>// write 
    data
    fclose(fh);
    //printf("file opened OK"); 
    }
    else
    {
    //printf("Error opening file"); 
    "";
    }
    }
    Buy_OK = SelectedValue<FONT 
    size=1>(Buy_Signal);
    Sell_OK = SelectedValue<FONT 
    size=1>(Sell_Signal);
    Short_OK = SelectedValue<FONT 
    size=1>(Short_Signal);
    Cover_OK = SelectedValue<FONT 
    size=1>(Cover_Signal);
    //Diagnostic printout
    "";
    "buy " +<FONT color=#0000ff 
    size=1>WriteVal(Buy_OK);<FONT color=#ff00ff 
    size=1>
    "sell" +<FONT color=#0000ff 
    size=1>WriteVal(Sell_OK);<FONT color=#ff00ff 
    size=1>
    "short " +<FONT color=#0000ff 
    size=1>WriteVal(Short_OK);<FONT color=#ff00ff 
    size=1>
    "cover " +<FONT color=#0000ff 
    size=1>WriteVal(Cover_OK);<FONT 
    color=#800000 size=1>
    if (DiskSave) <FONT color=#008000 
    size=1>// Disk Save feature is turned on
    {
    if (Buy_OK OR Sell_OK OR Short_OK 
    OR Cover_OK) // proccess if any 
    signal is present
    {
    for (i =<FONT color=#ff00ff 
    size=1>1; i<=<FONT color=#ff00ff 
    size=1>4; i++)
    {Trade = "xx"<FONT 
    size=1>;
    if (Buy_OK) 
    {Trade = "Buy"<FONT 
    size=1>;}
    else{
    if (Sell_OK) 
    {Trade = "Sell"<FONT 
    size=1>;}
    else{
    if (Short_OK) 
    {Trade = "Short"<FONT 
    size=1>;}
    else{
    if (Cover_OK) {Trade = <FONT color=#ff00ff 
    size=1>"Cover";}
    }}}
    if (trade != <FONT color=#ff00ff 
    size=1>"xx"); // if 
    trade signal exists proccess
    "trade " + Trade;
    {
    StringValue = Name<FONT 
    size=1>() + " " + 
    Trade + " " + 
    Date() + <FONT 
    color=#ff00ff size=1>" " + <FONT color=#0000ff 
    size=1>TimeNum() + " 
    " 
    + WriteVal<FONT 
    size=1>(LastValue<FONT 
    size=1>(Close));
    DiskDataSave(StringValue);
    }
    } // end loop
    } // end if
    } // end if 
    DiskSaveSend BUG REPORTS to 
    bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.