PureBytes Links
Trading Reference Links
|
Hi, Ed,
Thanks you very much for sharing the code. It works out fine.
Ken
--- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@xxx>
wrote:
>
> hi,
>
> yes I would think this is possible since a CSV type file is just a
comma separated file but I didn't test this. Are you using to code I
posted before? I have been adding the following to that file a while
back. See if it is of any use (see below). It creates a comma
separated file. The code I posted has some problems. Since many of the
trades are partially executed I add all the entry and exit trades up
and then when ( (-1) * (sharesStored_entry) == (sharesStored_exit))
the trade is closed and is ready for processing further. However if a
stock is split between entry and exit the code will not see this
automatically. You need to adapt the IB file for that. Also if the
stock is split at a later date, then the price retrieved from the
database does not correspond to the number of shares in the IB file,
>
> rgds, Ed
>
>
> // final calculations and store results in composities
> if ( (-1) * (sharesStored_entry) == (sharesStored_exit)) {
>
>
> //printf(symb + " shares entry " + sharesStored_entry + "\n");
> //printf(symb + " shares exit " + sharesStored_exit + "\n");
>
> // retrieve static variables
> open_entry = StaticVarGet( symb + "_Open_Entry" );
> shares_entry = StaticVarGet( symb + "_Shares_Entry" );
> executionprice_entry = StaticVarGet( symb +
"_ExecutionPrice_Entry" );
> commission_entry = StaticVarGet( symb + "_Commission_Entry" );
> date_entry = StaticVarGet( symb + "_Date_Entry" );
> date_entry_text = StaticVarGetText( symb + "_Date_Entry_Text" );
>
> open_exit = StaticVarGet( symb + "_Open_Exit" );
> shares_exit = StaticVarGet( symb + "_Shares_Exit" );
> executionprice_exit = StaticVarGet( symb + "_ExecutionPrice_Exit" );
> commission_exit = StaticVarGet( symb + "_Commission_Exit" );
> date_exit = StaticVarGet( symb + "_Date_Exit" );
> date_exit_text = StaticVarGetText( symb + "_Date_Exit_Text" );
>
> if (executionprice_entry >= open_entry * 1.4) {
>
> printf(symb + " Possible SPLIT " + "\n");
> printf(symb + " open_entry " + open_entry + "\n");
> printf(symb + " executionprice_entry " + executionprice_entry +
"\n");
> printf(symb + " factor " + (executionprice_entry / open_entry)
+ "\n");
>
> }
>
>
> // write information to a "CLEAN" file
> // first create output string
> if (shares_entry < 0) {
>
> delta_entry = (open_entry - executionprice_entry) / open_entry
* 100;
> delta_exit = (executionprice_exit - open_exit) / open_exit * 100;
> result_theory = (open_entry - open_exit) * shares_entry;
> result_theory = result_theory - (commission_entry +
commission_exit);
> result_practice = (executionprice_entry - executionprice_exit)
* shares_exit;
> result_practice = result_practice - (commission_entry +
commission_exit);
>
> outstr =
> symb
> + "," + "SELL"
> + "," + abs(shares_entry)
> + "," + date_entry_text
> + "," + open_entry
> + "," + executionprice_entry
> + "," + commission_entry
> + "," + date_exit_text
> + "," + open_exit
> + "," + executionprice_exit
> + "," + commission_exit
> + "," + delta_entry
> + "," + delta_exit
> + "," + result_theory
> + "," + result_practice
> + "," + "\n";
>
> } else if (shares_entry > 0) {
>
> delta_entry = (executionprice_entry - open_entry) / open_entry
* 100;
> delta_exit = (open_exit - executionprice_exit) / open_exit * 100;
> result_theory = (open_exit - open_entry) * shares_entry;
> result_theory = result_theory - (commission_entry +
commission_exit);
> result_practice = (executionprice_exit - executionprice_entry)
* shares_entry;
> result_practice = result_practice - (commission_entry +
commission_exit);
>
> outstr =
> symb
> + "," + "BUY"
> + "," + abs(shares_entry)
> + "," + date_entry_text
> + "," + open_entry
> + "," + executionprice_entry
> + "," + commission_entry
> + "," + date_exit_text
> + "," + open_exit
> + "," + executionprice_exit
> + "," + commission_exit
> + "," + delta_entry
> + "," + delta_exit
> + "," + result_theory
> + "," + result_practice
> + "," + "\n";
>
> }
>
>
> fputs(outstr, fh2 );
>
>
> ----- Original Message -----
> From: wel6
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Wednesday, September 19, 2007 2:09 AM
> Subject: [amibroker] Re: Trade Log for Amibroker and IB
>
>
> Hi, Ed,
>
> Is it possible to export the trades to a cvs type of file? I feel it
> should be possible using fputs, but I don't know how. If you have time
> could you help me with this?
>
> Thanks,
>
> Ken
> --- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@>
> wrote:
> >
> > hi Chris,
> >
> > I use HTLM format. The daily statement is Emaild to me everyday.
> Then I just use the mouse to select all yesterdays trades, copy them
> and paste in the output.txt file. I find that all the data necessary
> is in that HTML Email I receive from IB.
> >
> > The code I posted is actually meant for you to change it for your
> own needs. I track a few parameters that are specific for my system
> and are probably not very usefull for you. If you understand how the
> AFL code works then it is easy to adjust for your needs.
> >
> > Thanks for the suggestion of Tradekeeper. I will have a look,
> >
> > regards, Ed
> >
> >
> >
> >
> > ----- Original Message -----
> > From: christos_mav
> > To: amibroker@xxxxxxxxxxxxxxx
> > Sent: Monday, June 11, 2007 10:09 PM
> > Subject: [amibroker] Re: Trade Log for Amibroker and IB
> >
> >
> > Hi Ed
> >
> > yes you have right .. i try it and it funktion now ... very good.
> >
> > i have also one question about how you copy the data .
> > ok i want to say with it , when i for example download the
> > daily statements from ib . i have 3 possibilitys.. exel, word and
> html .
> > what you take...
> > i ask this because some rows of the data are not in the daily
> > statement. This means you manualy select the data you need to bring
> > them into this form..
> > ABX 2007-05-09, 11:00:00 ISLAND -56 31.2800 1,751.68 -1.00 0.00 P .
> >
> > There is for example a software **Tradekeeper&dataclipper** you
could
> > find the link on the site from IB. With this software you could read
> > the daily or monthly statements from IB and export them in excel.
> >
> > but the data looks a little bit diferent than this what you use to
> > import in AB.
> > so when you change your software to read this data you will have
less
> > work ...
> > what do you thing ..
> > regards chris
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@>
> > wrote:
> > >
> > > hi Chris,
> > >
> > > I know now what is the matter. It is the date settings on your
> > computer. I have them set to English (US). Because you are in Europe
> > you probably have them set differently.
> > >
> > > Datetime() in Amibroker uses system settings. So either you
set your
> > system settings to English (US) or tell me what you use so that
I can
> > adjust a few lines,
> > >
> > > Ed
> > >
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: christos_mav
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Sent: Saturday, June 09, 2007 9:19 AM
> > > Subject: [amibroker] Re: Trade Log for Amibroker and IB
> > >
> > >
> > > Hi Ed
> > >
> > > Yes bad time comes and goes :)
> > > It looks like i had thinked its very good.
> > > I have send also this code to the guys of the support in hopping
> > > i will find my failure.
> > > ( I hope you dont have a problem with this)
> > > I think this is realy a good think to implement fix in the
software.
> > > and i dont know if i am the only one find this important.
> > >
> > > ok today i could not solve my problem
> > > i have to go to family issues :)
> > > there is a wedding of a friend of me and maybee tomorrow
> > > i will have a clearer mind.
> > >
> > > regards
> > > chris
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@>
> > > wrote:
> > > >
> > > > Chris,
> > > >
> > > > with the AFL code I can plot a few things. I show 2, the
graph of
> > > the theoretical return + real return (started tracking this on
> May/9,
> > > before I tracked this stuff with Excel which cost me a lot of
> time. As
> > > you see my system having a bad period hehehe ... system is flat,
> I am
> > > making a some money). Then the other chart is normalised
cumulative
> > > delta (the difference between the open price en the entry / exit
> > > price). If this number is negative it means that I am performing
> > > better than my theoretical system. A number of -0.1 means 0.1% per
> > > trade better than the theoretical system.
> > > >
> > > > rgds, 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/
|