Actually, this is a little bit more complicated than that,
You need to take into account also the max open position limit and the number of exit signals for opened positions.
SetCustomBacktestProc( "" );
if( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject(); // Get backtester object
bo.PreProcess(); // Do pre-processing (always required)
for( i = 0; i < BarCount; i++ ) // Loop through all bars
{
n = bo.GetSignalQty( i , 1 );
for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
{
sig.PosSize = - 100 / n ;
}
bo.ProcessTradeSignals( i ); // Process trades at bar (always required)
}
bo.PostProcess(); // Do post-processing (always required)
}
From: pinaki_m77@yahoo.com [amibroker]
Sent: Tuesday, May 10, 2016 8:10 PM
To: amibroker@yahoogroups.com
Subject: [amibroker] Re: position size based on all symbols
My question was how do I find the value of this N.
Posted by: Aron Pipa <aron@myafl.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
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/
EmoticonEmoticon