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

Re: [amibroker] How to limit the size of position by both money and percent of equity ?


  • Date: Mon, 11 Jan 2010 23:18:58 +0100
  • From: Aron <aron.groups@xxxxxxxxx>
  • Subject: Re: [amibroker] How to limit the size of position by both money and percent of equity ?

PureBytes Links

Trading Reference Links



SetPositionSize(10, spsPercentOfEquity);

SetOption( "UseCustomBacktestProc", 1 );
if ( Status( "action" ) == actionPortfolio )
{

    bo =
GetBacktesterObject();
    bo.preProcess();

    
for ( bar = 0; bar < BarCount; bar ++ )
    {
   
        
for ( sig = bo.GetFirstSignal( bar ); sig && sig.isEntry(); sig = bo.GetNextSignal( bar ) )
        {
          

     
      _TRACE(""+ sig.posSize);
           
if ( -sig.posSize/100 * bo.equity > 10000)
            sig.posSize = -
10000/bo.equity * 100;
        }

        bo.ProcessTradeSignals( bar );       
    }

    bo.postProcess();

}










On 1/11/2010 4:11 PM, Roman wrote:
spsValue and spsPercentOfEquity are great, however, it is not clear how to limit the size of the position by both money and percent of equity whatever is less.

Say, I'd like to trade 10% of equity but no more than $10000 per trade. How to implement it ?

Thanks in advance.




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

**** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/

  



__._,_.___


**** 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___