Adding R-Multiple is provided as an example in the user guide.

http://www.amibroker.com/guide/a_custommetrics.html

Mike

--- In [email protected], Nick Willemse <nick.wille...@...> wrote:
>
> Hi Everyone,
> 
> I've been playing around with AB for awhile now and getting the hang  
> of working with arrays.
> 
> Now, i'm trying to add van tharp's r-multiple for each trade on the  
> backtester detailed report. R-multiple is trade profit divided by  
> initial trade risk.  But I am having problems as to how to add it.  I  
> am playing with the custom backtester, but how I can reference the  
> array that stores my initial trade risk values from the backtester?
> 
> My current backtester code looks like this and is just for debugging  
> purposes so far.  The output shows that MaxStopLoss[bar] is always  
> zero even though I've assigned it above this code:-
> 
> else if(AAAction == actionPortfolio)
> {
>       bo = GetBacktesterObject();
>       bo.PreProcess(); // Initialize backtester
>       for( bar=0; bar < BarCount; bar++)
>       {
>               bo.ProcessTradeSignals( bar );
>               for ( sig=bo.GetFirstSignal(bar); sig; 
> sig=bo.GetNextSignal(bar) )
>               {
>                       if (sig.isExit())
>                       {
>                               _TRACE("ENTRY: " + sig.symbol + "@" + sig.Price 
> + " stop @ " +  
> MaxStopLoss[bar]);
>                               //code need to go here to calc r-mul: 
> trade_profit /  
> maxstoploss[at_trade_entry]
>                       }
>               }
>       }
>       bo.PostProcess(); // Finalize backtester                
> }
> 
> Any help appreciated
> 
> Nick
>


Reply via email to