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

Re: [amibroker] not understanding positionsize



PureBytes Links

Trading Reference Links




Hello,
 
It is described in the User's Guide: System test settings 
window
 

Allow position 
size shrinking
If you mark this box AmiBroker will shrink down <FONT 
 color=#ffffff>positions if available 
equity is less than requested <FONT  
color=#ffffff>position size (via PositionSize variable). If this box is 
unmarked positions 
will not be entered in such case.
It means: you request the postion of 7500 dollars by saying 
PositionSize = 7500, now suppose that because of previous loosing 
trades your equity dropped below 7500.
Then suppose that this box is UNchecked then AmiBroker will NOT enter the 
position if you don't have enough funds
If this box is checked it WILL enter the position but the size of position 
will be equal to equity minus commission (instead of requested 7500)
PositionSize is determined on trade by trade basis.
System test settings window

Here you can define the following parameters of back-testing: 
General tab
Initial equity - defines the <FONT  
color=#ffffff>size of your account. Please note that in multiple security 
backtest it is per-symbol equity value
Positions 
considered (long, short, both long and short)
Futures mode
This check box in the settings page is the key to backtesting futures. It 
instructs backtester to use margin deposit and point value in calculations. 
Margin requirement
This setting defines percentage margin requirement for entire account. The 
default value of Margin requirement is 100. This means that you have to provide 
100% funds to enter the trade, and this is the way how backtester worked in 
previous versions. But now you can simulate a margin account. When you buy on 
margin you are simply borrowing money from your broker to buy stock. With 
current regulations you can put up 50% of the purchase price of the stock you 
wish to buy and borrow the other half from your broker. To simulate this just 
enter 50 in the Margin requirement field (see pic. 1) . If your intial equity is 
set to 10000 your buying power will be then 20000 and you will be able to enter 
bigger positions. 
Please note that this settings sets the margin for entire account and it is NOT 
related to futures trading at all. In other words you can trade stocks on margin 
account.
Commissions
  use portfolio commission table - backtester will use commission table as 
  defined in Tools->Portfolio->Settings 
  percent - commission is expressed as a percent of trade value 
  $ per trade - commission is fixed amount of dollars (or your currency) per 
  trade 
  $ per share/contract - commission is expressed in dollars (or your 
  currency) per share/contract purchased/sold 
Annual interest rate
This setting <FONT  
color=#ffffff>allows you to define annual interest earned when you are 
out of the market or your <FONT  
color=#ffffff>position is less than available equity.
Periodicity
This setting controls bar interval used for 
backtesting/scan/exploration/optimization. To backtest intraday data you should 
switch to proper interval there and then run the backtest.
Allow position 
size shrinking
If you mark this box AmiBroker will shrink down <FONT 
 color=#ffffff>positions if available 
equity is less than requested <FONT  
color=#ffffff>position size (via PositionSize variable). If this box is 
unmarked positions 
will not be entered in such case.
Activate stops immediatelly
When you trade on open and want to have built-in stops activated on the same 
bar - just mark this box.
If you trade on close and want built-in stops to be activated from the next 
bar - unmark this box.
You may ask why do not simply check the buyprice or shortprice array if it is 
equal to open price. Unfortunatelly this won't work. Why? Simply because there 
are doji days when open price equals close and then backtester will never know 
if trade was entered at market open or close. 
Round lot <FONT  
color=#ffffff>size
Various instruments are traded with various "trading units" or "blocks". For 
example you can purchase fractional number of units of mutual fund, but you can 
not purchase fractional number of shares. Sometimes you have to buy in 10s or 
100s lots. AmiBroker now <FONT  
color=#ffffff>allows you to specify the block <FONT 
 color=#ffffff>size on global and 
per-symbol level. 
You can define per-symbol round lot <FONT  
color=#ffffff>size in the Symbol->Information page. The value of zero 
means that the symbol has no special round lot <FONT 
 color=#ffffff>size and will use 
"Default round lot <FONT  
color=#ffffff>size" (global setting) from the Automatic Analysis settings 
page. If default <FONT  
color=#ffffff>size is set also to zero it means that fractional number of 
shares/contracts are <FONT  
color=#ffffff>allowed.
You can also control round lot <FONT  
color=#ffffff>size directly from your AFL formula using RoundLotSize 
reserved variable, for example:

  RoundLotSize = 10;
Tick <FONT  
color=#ffffff>size
This setting controls the minimum price move of given symbol. You can define 
it on global and per-symbol level. As with round lot <FONT 
 color=#ffffff>size, you can define 
per-symbol tick <FONT  
color=#ffffff>size in the Symbol->Information page. The value of zero 
instructs AmiBroker to use "default tick <FONT  
color=#ffffff>size" defined in the Settings page of Automatic Analysis 
window. If default tick <FONT  
color=#ffffff>size is also set to zero it means that there is no minimum 
price move.
You can set and retrieve the tick <FONT  
color=#ffffff>size also from AFL formula using TickSize reserved 
variable, for example:

  TickSize = 0.01;
Note that the tick <FONT  
color=#ffffff>size setting affects ONLY trades exited by built-in stops 
and/or ApplyStop(). The backtester assumes that price data follow tick <FONT 
 color=#ffffff>size requirements and it 
does not change price arrays supplied by the user.
So specifying tick <FONT  
color=#ffffff>size makes sense only if you are using built-in stops so 
exit points are generated at "<FONT  
color=#ffffff>allowed" price levels instead of calculated ones. For 
example in Japan - you can not have fractional parts of yen so you should define 
global ticksize to 1, so built-in stops exit trades at integer levels.
Reverse entry signal forces exit
When it is ON (the default setting) - backtester works as in previous 
versions and closes already open positon if new entry signal in reverse 
direction is encountered. If this switch is OFF - even if reverse signal occurs 
backtester maintains currently open trade and does not close positon until 
regular exit (sell or cover) signal is generated. In other words when this 
switch is OFF backtester ignores Short signals during long trades and ignores 
Buy signals during short trades.
Allow same 
bar exit (single bar trade)
When it is ON (the default settings) - entry and exit at the very same bar is 
allowed (as in 
previous versions)if it is OFF - exit can happen starting from next bar only 
(this applies to regular signals,there is a separate setting for 
ApplyStop-generated exits). Switching it to OFF <FONT 
 color=#ffffff>allows to reproduce the 
behaviour of MS backtester that is not able to handle same day exits.
Trade tab
  prices buy/sell/short/cover price fields - <FONT 
   color=#ffffff>allows the user to 
  define at which price to buy/sell/short sell/buy to cover during system test 
  delays buy/sell/short/cover delay - <FONT 
   color=#ffffff>allows to define custom 
  delay between signal and trade 
Stop tab
  max. loss stop 
  profit target stop 
  trailing stop 
Report tab
Drawdown figures based on...
Drawdown figures in the backtest report measure equity dip experienced during 
the trade(s). To calculate the dip you can use the worst case scenario: low 
price for long trades and high price for short trades or single price (open or 
close) for both long and short trades. "Drawdown figures based on..." setting 
(pic. 2) allows you 
to choose the price(s) used to calculate drowndowns. Using worst case scenario 
you will get a few percent bigger drawdowns than using close or open price. On 
the other hand Equity() function always uses shortprice/coverprice array so you 
may choose open or close field here to match drawdowns as observed in equity 
line.
Formula
- mark this box to include AFL formula in the backtest report
Settings
- mark this box to include settings in the backtest report
Incl. out-of-market pos
- mark this box to include out-of-market <FONT 
 color=#ffffff>positions in the backtest 
report
Overall summary
- mark this box to include sum of individual symbol backtest results
Symbol summary
- mark this box to include per-symbol summaries
Trade list
- choose format of trade list included in the report
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Dave Merrill 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, September 13, 2003 12:04 
  AM
  Subject: RE: [amibroker] not 
  understanding positionsize
  
  <SPAN 
  class=498355721-12092003>leaving Portfolio Trader aside, what does it mean to 
  uncheck 'Allow position size shrinking'? the docs say that new 
  positions won't be entered if there isn't sufficient equity. do I gather that 
  this means only that one individual position can't exceed the total value of 
  the account? but the total of multiple purchases still 
  can?
  <SPAN 
  class=498355721-12092003> 
  <SPAN 
  class=498355721-12092003>thanks,
  <SPAN 
  class=498355721-12092003> 
  <SPAN 
  class=498355721-12092003>dave
  <BLOCKQUOTE 
  >
    >Amibroker, at least the current version, assumes that 
    your entire portfolio is comprised of only one stock
    This is not true. You can backtest multiple stocks 
    (example: set PositionSize = -20 and backtest over 5 symbol watch list the 
    results,
    and in that case you can create portfolio equity using 
    AddToComposite)
     
    >It is not capable of portfolio 
backtesting
    Not true. It is capable of portfolio backtesting even 
    now.
    You can run portfolio backtest using PortfolioTrader 
    formula for example.
     
    Correct would be to say that AB does not have native 
    portfolio backtest report.
     
    Best regards,Tomasz Janeczkoamibroker.comSend 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Attachment: Description: ""