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

[amibroker] Risk:Reward ratio custom code - not working



PureBytes Links

Trading Reference Links

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>";

	}
}




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/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 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 &amp; 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 &amp; communities. is subject to:
    http://docs.yahoo.com/info/terms/