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

[amibroker] TJ Can you add to Pane



PureBytes Links

Trading Reference Links

Herman van den Bergen wrote:

> The easiest way to determine trade profits is to sample the equity 
> curve as created by AB. For example:
>  
> // your system here....(the following code untested)
> E=Equity(1);
> LongEntryEquity = valuewhen(ref(Buy,-1),E);
> LongExitEquity = valuewhen(ref(Sell,-1),E);
> LongTradeProfit = valuewhen(ref(sell,-1), LongExitEquity-LongEntryEquity);
> Plot(LongTradeProfit,"LTP",1,1);


Note that you will need ExRem(Buy,Sell) and ExRem(Short,Cover) 
statements if your technique involves the possibility of repeated entry 
signals before the exit, or the ValueWhen() statement will wind up 
referring to the most recent signal, rather than the one on which you 
entered.

I have plead with Tomasz to give us a BarsSince(Entry) function 
intermittently for several years now.  ExRem() and ExRemSpan() will do 
the job between them.  I believe Tomasz was kind enough to provide 
ExRemSpan() specifically to solve a problem I had, and I am profoundly 
grateful to him; customer service doesn't get any better than that.  
However, there are still situations in which the logic of repeated 
signals becomes so convoluted that I lose track and waste endless hours 
trying to be sure I've accounted for all the variations--and then am 
never quite sure that I have succeeded.  BarsSince(Entry) would 
eliminate that problem.

For an illustration, try implementing the classic Larry Williams 
volatility breakout entry and bailout exit.  Enter when the price rises 
or falls from the Open by a set fraction of the previous day's range.  
Exit on the first profitable Open after a delay of one or more bars.  
This frequently produces repeated entry signals before the exit, and 
often gives a new signal on the exit day; it gets complicated enough to 
give you the idea.  This can be solved using ExRem() and ExRemSpan(), 
but the code would be cleaner with a BarsSince(Entry) function.

Owen Davies


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/