PureBytes Links
Trading Reference Links
|
A backtest gives the results you want automatically.
If you must use Explore, you can also code the profit yourself
using the Buy/Sell variables and explore for the answer.
You will need ValueWhen function to discover the BuyPrice on the last
Buy.
Here is some explore code that does what you want.
I'm sure you will have to modify to suit.
Unfortunately, this code my confuse you more than help you!
I tried to remove lines that were not relevant to your question.
PS: This is for a Long only system.
/****************************** FOR EXPLORE
**********************************/
entryPrice = ValueWhen(Ref(Buy,-1),O); //Get the Open price on the day
you bought
gain = IIf(Sell,(exitPrice - entryPrice) / entryPrice * 100 - 0.4,0);
//Account for 2 way commissions at .2% each
//>>>>>>>>>>>>>>>>>>>>>>>>>> "look to future" code - Just for marking
Next Day Buy in Explore
bdate = IIf(Sell,ValueWhen(Ref(Buy,-1),DateTime()),DateTime());
Filter = Buy OR Sell;
AddColumn(bdate,"Buy
Date",formatDateTime,IIf(Buy,colorWhite,colorRed),IIf(Buy,colorGreen,col
orWhite));
AddColumn(C,"Close",1.2,IIf(Buy,colorWhite,IIf(Sell AND gain >
0,colorGreen,colorWhite)),IIf(Buy,colorGreen,IIf(Sell AND gain >
0,colorPaleGreen,IIf(Sell,colorRed,colorGold))),50);
AddColumn(IIf(Buy,0000,entryPrice),"Entry$",1.2,IIf(Buy,colorGreen,IIf(S
ell AND gain > 0,colorGreen,colorWhite)),IIf(Buy,colorGreen,IIf(Sell AND
gain > 0,colorPaleGreen,colorRed)));
AddColumn(IIf(Buy,9999,IIf(Sell,gain,0)),"Profit%",1.2,IIf(Buy,colorGree
n,IIf(Sell AND gain >
0,colorGreen,colorWhite)),IIf(Buy,colorGreen,IIf(Sell AND gain >
0,colorPaleGreen,colorRed)),50);
The last two lines test to see if it's a Buy or a Sell. If it's a Sell,
one line prints the entry price and the next line prints the Gain
(loss). If it's a Buy then I print 0000 or 9999 which are effectively
blanked by my color-coding.
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of thecoolestdude1369
Sent: Thursday, November 09, 2006 08:22
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: really really need help....
bummer.... thx for the help.
--- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxx> wrote:
>
> Given the system you are looking at and assuming that it is for a
> single tradable at a time, on some particular day ( which is how
> exploration results are ordered ) there could only be either the
> effective buy or sell price ...
>
> --- In amibroker@xxxxxxxxxxxxxxx, "thecoolestdude1369"
> <thecoolestdude1369@> wrote:
> >
> > i was expecting to see a column with all the buy prices and
since
> > the formula won't trigger on the same day all the sell prices in
> the
> > next column. they should both be different prices. for
instance
> > the price of the stock at the close when all buy criteria is met
> and
> > the price of the stock at the close when all sell criteria is
met
> > for the trade to close out. this way i can look and see profit
and
> > loss.
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Mark H" <amibroker@> wrote:
> > >
> > > What do you expect to see then?
> > >
> > > BuyPrice and SellPrice are arrays which are automatically
> assigned
> > by the Settings under the "Trades" tab.
> > > They are of course the same if they are both set to open or
close
> > in the Settings there.
> > >
> > > ----- Original Message -----
> > > From: thecoolestdude1369
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Sent: Wednesday, November 08, 2006 6:21 PM
> > > Subject: [amibroker] really really need help....
> > >
> > >
> > > i've sent this in before but can't seem to get it to work
and
> > have not
> > > got any fix. i've read the guide, i've looked at countless
> > examples
> > > and went through the tutorial several times and still can't
get
> > this
> > > to work. here's a simple formula that i found in the
tutorial--
> > which
> > > seems to work fine in scan and backtest but having abolutely
no
> > > success in exploration.... buy and sell price are always the
> > same and
> > > never show the profit or loss. what am i doing wrong!?
please
> > help...
> > > i want it to work for exploration./
> > >
> > > Buy = Cross(Signal(),MACD());
> > > Sell = Cross(MACD(), Signal());
> > >
> > > Filter = Buy OR Sell;
> > >
> > > AddColumn(BuyPrice,"buy price", 10.2);
> > > AddColumn(SellPrice,"sell price",10.2);
> > > AddColumn(BuyPrice-SellPrice,"profit",10.2);
> > >
> >
>
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
http://groups.yahoo.com/group/amibroker/
Individual Email | Traditional
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
amibroker-unsubscribe@xxxxxxxxxxxxxxx
http://docs.yahoo.com/info/terms/
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/542 - Release Date: 11/20/2006
|