You may have to use SetBarsRequired()
herman
Friday, February 23, 2007, 8:31:35 AM, you wrote:
> Hello Alex,
> I only have a minute and can't go into your code fully,
> On the off chance it helps.
> I was debugging today and found the cause of my challenge was
> ValueWhen - it only looks back so far - the number bars lookback is
> limited - at least in my code anyway.
> Plot this and scroll any chart with a few hundred bars to see what I
> mean.
> V = ValueWhen((BarIndex() == 0),C, 1);
> Plot(V,"BarIndex0Close",1,1);
> After so many bars from bar0 the value returned is {Empty}.
> It might be your problem.
> Regards,
> BrianB2.
> --- In amibroker@xxxxxxxxxxxxxxx, "dralexchambers"
> <dralexchambers@xxx> wrote:
>> Hi,
>> I am writing some AFL that outputs a Risk:Reward ratio for each
> trade
>> to an HTML file.
>> I am using the AFL code at the bottom of this email.
>> The code outputs trades and ratios correctly from 2001-27/09/2005,
>> but then trails off. This is strange, as I have trades entering and
>> exiting up to 2007. You can see this HTML output here:
>> http://alexanderchambers.freewebspace.com/AdvancedTradeOutput.html
>> If anyone could try this code out and advise I'd be really grateful.
>> Alex
>> ===========================================================
>> dtBuy = ValueWhen(Buy,DateTime()); // Date of buy
>> dtSell= ValueWhen(Sell,DateTime()); // Date of sell
>> rskL = IIf(Sell, (ValueWhen(Buy,LongStopBuy) -
>> ValueWhen(Buy,LongStop)), 0);
>> rwdaL = IIf(Sell,(SellPrice-ValueWhen(Buy,BuyPrice)),0);
>> rrwdL = 0;
>> rrwdL = rwdaL / rskL; // This is the Risk:Reward ratio - works
>> fine
>> a = "<html><body><table border='1'><tr><td>Direction</td><td>In</
>> td><td>Out</td><td>Risk:Reward</td></tr>";
>> for (i=1; i<BarCount; i++)
>> {
>> if (Sell[i])
>> {
>> a = a + "<tr><td>BUY</td><td>"+DateTimeToStr(dtBuy[i])
> +"</
>> td><td>"+DateTimeToStr(dtSell[i])+"</td><td>"+rrwdL[i]+"</td></tr>";
>> }
>> }
> 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 - Join or create groups, clubs, forums & communities. 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 - Join or create groups, clubs, forums & communities. is subject to:
> http://docs.yahoo.com/info/terms/
>
__._,_.___
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
SPONSORED LINKS
__,_._,___
|