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

[amibroker] Re: Bling Freddy trend



PureBytes Links

Trading Reference Links




Tomasz.
 
Firstly I am new to Amibroker.
 
I have been following the discussion on the "margin 
requirement" with interest.
 
I Trade Contracts for Difference with a 10% deposit 
and 90% borrowed.
 
I can manage to set the account size and margin ok 
however what I would like to do is only utilize a percentage (say 70%) of my 
cash leaving some to meet margin calls. The remaining 30% would be dynamic and 
the actual amount adjust as the portfolio value changes. 
 
In the "Back testing settings" there is the initial 
Equity. I can alter this to give a false starting value but I am not sure that 
that provides the answer.
 
Below is my code for position sizing and 
margin. Ignore some of the bits I have been trying to 
optimize. 
Can you suggest how to alter the allowable 
"capital"
 
(initial $10k account allows holdings of 
$100K).
 
John.
 
Margin = Param<FONT 
size=2>("Margin 100 = No Margin"<FONT 
size=2>,10, <FONT 
color=#ff00ff size=2>5, <FONT color=#ff00ff 
size=2>100, 5<FONT 
size=2>);     <FONT 
size=2>// current margin = 10%<FONT 
size=2>
SetOption(<FONT 
color=#ff00ff size=2>"MarginRequirement", Margin);<FONT 
color=#008000>     <FONT 
color=#008000>//100 = no margin 
// MaxPos = Optimize("Max Open Positions", 3, 3,105, 1); 
// Allows 3 max positions
//MaxPos = Max Open Positions, 5; <FONT 
size=2>
//SetOption("MaxOpenPositions", 
MaxPos);

PositionSize = (-10000<FONT 
size=2>/Margin) /5 
;     // current MaxPos 
set to 5
 
 
 
<BLOCKQUOTE dir=ltr 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Tomasz Janeczko 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, August 05, 2004 9:23 
  AM
  Subject: Re: [amibroker] help on Set 
  Option marginrequirement AFL
  
  Hello,
   
  In reality you can not change the margin the 
  account has assigned.
  Margin is set by your BROKERAGE. And brokerages 
  must obey SEC regulations.
  Current regulations are that margin allowed is 
  50% (in US)
   
  You can not change it by yourself.
   
  What you want to do is really investing less than 
  your buying power including margin is.
  And yes you should use positionsize to vary 
  your risk exposure.
   
  If you specify 
  PositionSize = -100;
   
  you use only your own cash.
   
  If you specify
  PositionSize = -200;
  it means use 200% buying power -> i.e. FULL 
  50% margin.
   
  If you specify
  PositionSize = -150;
   
  You use your own funds plus half of allowable 
  margin.
  Best 
  regards,Tomasz Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    malc 
    fiveeightninenine 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Wednesday, August 04, 2004 9:43 
    PM
    Subject: Re: [amibroker] help on Set 
    Option marginrequirement AFL
    
    PositonSize changes the amount I buy for each position, not the overall 
    degree of margin the portfolio uses.
     
       For example....Supose I run a portfolio of 50 stocks each 
    with a positonsise of 2% of the portfolio value.  Each day it sells 
    whatever stocks the positionscore has dropped to below the 
    sellscore. Also that day it buys whatever stocks have to best 
    positionscore up to the available amount of cash. 
     
       Since I am too risk averse to use the full amount of 
    margin available from by broker (50%) I have been setting the 
    marginrequirement value at an intermediate of 74% which is part way between 
    what the broker allows and no margin at all (100%). That way the backtest 
    simulates the margin determined by my level of risk tolerance.
     
       What I would like to test is adjusting the margin target 
    on a day to day basis.  If I believe that the stocks I own tend to lag 
    the index I would increase the amount of money I borrow from the broker in 
    order to have a portfolio of 55 stocks of the same average 
    postionsize.  On days that the index declines I would have 45 stocks of 
    the same average positionsize.
     
    Is this possible to test?
     
    Tomasz Janeczko <amibroker@xxxxxx> wrote:
    <BLOCKQUOTE class=replbq 
    >
      
      

      Hello,
       
      You should modify POSITIONSIZE variable 
      instead.
      Best regards,Tomasz Janeczkoamibroker.com
      <BLOCKQUOTE 
      >
        ----- Original Message ----- 
        <DIV 
        >From: 
        malc 
        fiveeightninenine 
        To: <A 
        title=amibroker@xxxxxxxxxxxxxxx 
        href="">amibroker@xxxxxxxxxxxxxxx 
        
        Sent: Wednesday, August 04, 2004 
        5:11 PM
        Subject: Re: [amibroker] help on 
        Set Option marginrequirement AFL
        
        Maybe Marginrequirement isn't what I should be adjusting 
then.
         
        What I am attempting to do is change the amount of available funds 
        to the portfolio day to day depending on market conditions. 
         
        What variable should I adjust?Tomasz Janeczko <<A 
        href="">amibroker@xxxxxx> 
        wrote:
        <BLOCKQUOTE class=replbq 
        >Hello,MarginRequirement 
          is a property of your brokerage account and it has to be fixed (not 
          changing from bar to bar).It was explained here four days 
          ago:http://finance.groups.yahoo.com/group/amibroker/message/68093Best 
          regards,Tomasz Janeczkoamibroker.com----- Original Message 
          ----- From: "malc5899" To: 
          Sent: Wednesday, August 04, 2004 4:27 
          PMSubject: [amibroker] help on Set Option marginrequirement 
          AFL> > > Anyone know why this error 
          occurs?> > > 
          QQQtoday=(Foreign("QQQ","Close")-Ref(Foreign("QQQ","Close"),-1))/Ref> 
          (Foreign("QQQ","Close"),-1)+1;/* */> > Margin = 
          100/QQQtoday;/* 100=no margin */> > Margin 
          =Nz(Margin,100);> > 
          SetOption("MarginRequirement",Margin);> 
          -------------------------------------^> > Error 
          2.> Bad argument(s)> > > > > 
          > 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> > > > > 
          > ------------------------ 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/
        
        
        Do you Yahoo!?<A 
        href="">New 
        and Improved Yahoo! Mail - Send 10MB messages! Check 
        AmiBroker web page at:<A 
        href="">http://www.amibroker.com/Check 
        group FAQ at: <A 
        href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
        Check AmiBroker web page at:<A 
        href="">http://www.amibroker.com/Check 
        group FAQ at: <A 
        href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
        
    
    
    Do you Yahoo!?Yahoo! Mail is new and improved - <A 
    href="">Check 
    it out! Check AmiBroker web page at:<A 
    href="">http://www.amibroker.com/Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Check AmiBroker web page at:<A 
    href="">http://www.amibroker.com/Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    


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

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.