PureBytes Links
Trading Reference Links
|
You have to be extremely specific in writing AFL (or any computer
junk) as it takes everything written literally
the valuewhen looks back to the last occurence of the event specified,
including iof the even is current bar.
Have you set the
filter=buy or sell;
otherwise whilst it is in a trade it will be looking back to last sell
condition.
If you want a progressive value of the trade return then you ahve to
include some options for when it is in the trade.
intrade=Flip(Buy,Sell);
Filter=1;
AddColumn( IIf( intrade OR Sell, ValueWhen(Buy,BuyPrice), Null), "BuyP", 1.3);
AddColumn( IIf( intrade, C/ValueWhen(Buy,BuyPrice),
ValueWhen(Sell,SellPrice)/ValueWhen(Buy,BuyPrice) ), "Return", 1.3);
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
On 3/11/06, dimension@xxxxxxxxxxxxx <dimension@xxxxxxxxxxxxx> wrote:
> I'm buying/selling the close and there is no delay set.
>
> I am not sure what the problem may be but could be related to the
> "valuewhen(sell, Close ) " part of the code
>
> When I add the columns below to the exploration:
> AddColumn( valuewhen(Buy, Close ) , "Entry", 1.2 );
> AddColumn( valuewhen( Sell, Close ) , "Exit", 1.2 );
>
> And then compare the output of the back test to the output of the
> exploration, I notice that 'Exit' price of the exploration is always showing
> the previous exit price of the back test.
>
> So if the back test shows:
>
> Ticker date Entry Exit
> QQQQ 2/22/2006 41.26 41.15
> QQQQ 2/24/2006 41.26 41.10
> QQQQ 3/1/2006 41.66 41.45
> QQQQ 3/8/2006 40.87 40.52
>
> The Exploration shows this:
>
> Ticker date Entry Exit
> QQQQ 2/14/2006 40.26 41.21
> QQQQ 2/24/2006 41.26 41.15
> QQQQ 3/1/2006 41.66 41.10
> QQQQ 3/8/2006 40.87 40.45
>
>
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
> Of Graham
> Sent: Saturday, March 11, 2006 12:26 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Pct Change in Exploration
>
> Ok, perhaps you have a delay built into the backtest you need to match
> that in your exploration
> eg 1 bar delay
>
> PctChg = ( valuewhen(ref(sell,-1), Close ) - valuewhen(ref(BUY,-1),Close )
> )/
> > valuewhen(ref(BUY,-1),Close) * 100;
>
> Then are your backtest set to buy and sell at close price, or another
> price? If so then you need to use whatever you have set for the
> backtest.
> You have to match the backtest conditions in your exploration.
>
>
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
> On 3/11/06, dimension@xxxxxxxxxxxxx <dimension@xxxxxxxxxxxxx> wrote:
> > Hmmm, that's what I tried, but when running the exploration vs the back
> > test, I am getting different percent returns for a given trade. What's
> > interesting is the dates of trades are same between the exploration and
> back
> > test, but the entry and exits are not.
> >
> > -----Original Message-----
> > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
> Behalf
> > Of Graham
> > Sent: Friday, March 10, 2006 9:47 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: Re: [amibroker] Pct Change in Exploration
> >
> > here is %change in price between buy and sell
> >
> > PctChg = ( valuewhen(sell, Close ) - valuewhen(BUY,Close ) )/
> > valuewhen(BUY,Close) * 100;
> >
> >
> >
> > --
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://e-wire.net.au/~eb_kavan/ab_write.htm
> >
> >
> >
> > On 3/11/06, Ara Kaloustian <ara1@xxxxxxxxxx> wrote:
> > >
> > >
> > > Have you tried to calculate the % change based on referencing the buy
> > signal on the sell date?
> > >
> > > I beleive the Buy/Sell arrays are thesame for backtest and explore
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: dimension@xxxxxxxxxxxxx
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Sent: Friday, March 10, 2006 12:45 PM
> > > Subject: [amibroker] Pct Change in Exploration
> > >
> > >
> > >
> > >
> > > I have a system that that gives a BUYS based on some indicator readings
> > and SELL based on other indicator readings.
> > >
> > > Works great as a back test. I'd like to convert this to an exploration
> > but the difficulty I am having is figuring out how to calculate the
> > percentage change between the buy and sell signals. Typically in
> > explorations I do something like this to calculate the percentage change
> > array based on a Fixed number of bars, N.
> > >
> > > PctChg = ( Ref( Close, N ) - Close ) / Close * 100;
> > >
> > >
> > >
> > > How do I do the samething based on Buy and Sell arrays? Is there away
> for
> > a given Buy, to get the bar at which the Sell occurs?
> > >
> > >
> > >
> > > 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 other support material please check also:
> > > http://www.amibroker.com/support.html
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > SPONSORED LINKS
> > > Investment management software Real estate investment software
> Investment
> > property software
> > > Software support Real estate investment analysis software Investment
> > software
> > >
> > > ________________________________
> > YAHOO! GROUPS LINKS
> > >
> > >
> > > Visit your group "amibroker" on the web.
> > >
> > > To unsubscribe from this group, send an email to:
> > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> > > To unsubscribe from this group, send an email to:
> > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> > >
> > > ________________________________
> >
> > >
> > >
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 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/
<*> 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/
|