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

[amibroker] Re: fopen read/write



PureBytes Links

Trading Reference Links

Have you thought about using the Osaka plug-in?

PS
--- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@xxx> 
wrote:
>
> ok thanks Ara.   Indeed I believe one can not use fopen(fn,rw); 
where rw means reading as well as writing. I just want to be able to 
replace 100 but not during trading just when I am checking my basket 
after I set it up. Then I can compare exit and profit target orders 
with the existing positions,
> 
> rgds, ed
> 
> 
> 
>   ----- Original Message ----- 
>   From: Ara Kaloustian 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, June 12, 2007 4:21 PM
>   Subject: Re: [amibroker] fopen read/write
> 
> 
> 
>   Ed,
> 
>   When you use text files (as in AFL), I beleive you can not change 
contents. You can just add lines. (You might try replacing the line 
with a blank and then re-write with desired contents - but am not 
sure)
> 
>   Suggest you change the format and add a correction to the 
existing line. This is possible as long as you have not closed the 
file or added a carriage return.
> 
>   The new line could look like this:
> 
>   SELL, 100, CHRW, STK, SMART, LMT, 52.44, 1,80,
> 
>   where you have ordered 100 shares and got filled on 80. 
> 
>   This would require to write each line in 2 write operations
> 
>   For statistical info this might be better, so you know how often 
you get partial fills.
> 
>   Ara
>     ----- Original Message ----- 
>     From: Edward Pottasch 
>     To: amibroker@xxxxxxxxxxxxxxx 
>     Sent: Tuesday, June 12, 2007 5:38 AM
>     Subject: Re: [amibroker] fopen read/write
> 
> 
>     hi Joe,
> 
>     thanks for your reply. I have a basketfile with lines like:
> 
>     SELL, 100, CHRW, STK, SMART, LMT, 52.44, 1,
> 
>     a whole bunch of lines like this one above I send to the TWS. I 
wrote some code that checks if the number of shares correspond to the 
number of shares I have in my portfolio at IB.
> 
>     So I want to be able to look at the number 100 in this example, 
compare it to the real number of shares I have and then adjust the 
number 100 if necessary.  I know I could open a second file and use 
it to write to. I however want to use the same file and change a 
number in that file if necessary. In C or C++ or any other language 
this is possible. Since AFL uses more or less the C syntax I wondered 
if we could do this in AFL as well,
> 
>     rgds, Ed
> 
> 
> 
>       ----- Original Message ----- 
>       From: Joe Landry 
>       To: amibroker@xxxxxxxxxxxxxxx 
>       Sent: Tuesday, June 12, 2007 2:19 PM
>       Subject: Re: [amibroker] fopen read/write
> 
> 
> 
>       Ed, as I read your question literally, YES, one can read, 
write and append to a file.  Like so from the Users Guide.
>       Simultaneously - NO.  Programs including AFL are serial. 
>          
>       Now if you mean you want to change some elements or fields in 
that file, you'll have to read in the record of that file, change the 
field and write the record back out.
> 
>       HTH
>       Joe 
> 
>       >>> 
>       fputs( string, filehandle )  
>       RETURNS NOTHING  
>       FUNCTION  Writes (puts) the string to the file. 
>       The filehandle must be a number returned by fopen function 
used to open the file. 
>       The file has to be open for writing or appending ("w" or "a") 
for this fputs to work. 
> 
> 
> 
>         ----- Original Message ----- 
>         From: Edward Pottasch 
>         To: amibroker@xxxxxxxxxxxxxxx 
>         Sent: Tuesday, June 12, 2007 6:26 AM
>         Subject: [amibroker] fopen read/write
> 
> 
> 
>         hi,
> 
>         anyone know if one can read + write to a file. I need to 
read a file and change some numbers if necessary. Seems that AFL can 
only read or write or append. In C or C++ it is possible 
simultaneously. Anyone know how to do it in AFL?
> 
>         thanks, Ed
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/