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

[amibroker] Re: Adding R-multiple to backtest



PureBytes Links

Trading Reference Links

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

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

Mike

--- In amibroker@xxxxxxxxxxxxxxx, Nick Willemse <nick.willemse@xxx> 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
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups 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 is subject to:
    http://docs.yahoo.com/info/terms/