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

RE: [amibroker] Re: Applystop again



PureBytes Links

Trading Reference Links

just curious as to what that "other product" might be.
 
Have you looked at AB's Portfolio Backtester Interface?
 
d


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of enzo
Sent: Thursday, September 08, 2005 11:16 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Applystop again

Terry,

actually I dont know how function equity() can help me to calculate
the number of shares per position that has been bougth while
backtesting. Documentation on this is, as for many other functions,
very poor and there are no examples at all for the needs I have on
this specific problem.

While I find Amibroker is a very impressive tool and has sometimes
surprisingly useful functions, I cannot understand why such a
fundamental information like "TradeSize" is not easily available
like other arrays p.e. buyprice, sellprice etc.

I am spending hours and hours trying this and that for 3 days
already and I dreamt about it last night. Sometimes its just
frustrating and I guess to use a more expensive product with a
better documentation would save me a lot of nerves and time.

enzo



--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> Now I see what you are really trying to do. Seems like this should
be
> possible with a custom backtest routine or maybe just the equity()
> function. Also, I don't see why you couldn't extend your code
below to
> figure the equity. You have the shares and the exit price so you
could
> keep a running total, yes?
> --
> Terry
> | -----Original Message-----
> | From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx] On
> | Behalf Of enzo
> | Sent: Wednesday, September 07, 2005 11:12
> | To: amibroker@xxxxxxxxxxxxxxx
> | Subject: [amibroker] Re: Applystop again
> |
> | Hi Terry,
> |
> | thank you for your suggestion anyway! But the meaning of your
code
> | is, the stops would be executed when the price of the share
reaches
> | 1000 or 700. This in most cases never happens.
> |
> | With following code I came close to the expected results, but in
> | most cases I did not, because backtester uses 5% of the current
> | cumulated capital, which I also prefer but cannot calculate:
> |
> | TargetStop =  1000.00;
> | StopLoss   =   700.00;
> |
> | Capital         = GetOption("InitialEquity");
> | Investment = IIf(PositionSize<0,Capital*abs
> | (PositionSize)/100,PositionSize);
> |
> | NumberOfShares = investment/BuyPrice;
> |
> | TargetStopPoints = TargetStop/NumberOfShares;
> | StopLossPoints      = StopLoss/NumberOfShares;
> |
> | ApplyStop(stopTypeLoss,stopModePoint,
> |
amount=StopLossPoints,ExitAtStop=1,Volatile=False,ReEntryDelay=1);
> |
> | ApplyStop(stopTypeProfit,stopModePoint,
> |
amount=TargetStopPoints,ExitAtStop=1,Volatile=False,ReEntryDelay=1);
> |
> |
> | enzo
> |
> | --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> | > Try this or some variation:
> | >
> | >
> | >
> | > PositionSize = -5; //Spends 5% of your equity
> | >
> | > ApplyStop(StopModeProfit, stopModePoint, 1000, exitatstop = 0,
1
> | or 2,
> | > 0, re-entry delay = 0,1,2...);
> | >
> | > ApplyStop(StopModeLoss, stopModePoint, 700, exitatstop = 0, 1
or
> | 2, 0,
> | > re-entry delay = 0,1,2...);
> | >
> | >
> | >
> | > Buy = your buy conditions;
> | >
> | > Sell = your buy conditions;
> | >
> | >
> | >
> | > If you want to buy multiple positions then also set
> | MaxOpenPositions and
> | > adjust PositionSize to be -5 * MaxOpenPositions.
> | >
> | >
> | >
> | > MaxOpen = 5; //Buy up to 5 positions
> | >
> | > SetOptions(MaxOpenPositions,MaxOpen);
> | >
> | > PositionSize = MaxOpen * -5; //Spend 5% of portfolio on each
> | position
> | >
> | >
> | >
> | > (Note: code not tested.)
> | >
> | > --
> | >
> | > Terry
> | >
> | >
> | >
> | > | -----Original Message-----
> | >
> | > | From: amibroker@xxxxxxxxxxxxxxx
> | [mailto:amibroker@xxxxxxxxxxxxxxx] On
> | >
> | > | Behalf Of enzo
> | >
> | > | Sent: Wednesday, September 07, 2005 07:08
> | >
> | > | To: amibroker@xxxxxxxxxxxxxxx
> | >
> | > | Subject: [amibroker] Applystop again
> | >
> | > |
> | >
> | > | Hello Usergroup,
> | >
> | > |
> | >
> | > | I read dozens of mails of this group about this but it seems
my
> | >
> | > | applystop-problem has not been discussed before.
> | >
> | > |
> | >
> | > | I want to backtest a strategy in non-futures-mode where 5%
of the
> | >
> | > | capital is beeing used to open a position and profit-target-
stops
> | >
> | > | and Stop-Loss are executed after a certain amount, say 1000
as
> | >
> | > | profit and 700 as loss is reached for the whole position.
> | >
> | > |
> | >
> | > | Is there an easy way to calculate the number of shares beeing
> | bought
> | >
> | > | or shorted? Results of my calculation
> | >
> | > | (NumberOfShares=investment/BuyPrice;) are always different
from
> | the
> | >
> | > | numbers the backtester calculates.
> | >
> | > |
> | >
> | > | Has anyone coded the same strategy and would like to help me
with
> | >
> | > | the snippet of code that I need for axecuting the stops?
> | >
> | > |
> | >
> | > | Thank you in advance
> | >
> | > | enzo
> | >
> | > |
> | >
> | > |
> | >
> | > |
> | >
> | > |
> | >
> | > |
> | >
> | > |
> | >
> | > | ------------------------ Yahoo! Groups Sponsor --------------
----
> | --~--
> | >
> | > | >
> | >
> | > | Help Sudanese refugees rebuild their lives through
GlobalGiving.
> | >
> | > | http://us.click.yahoo.com/hjNroD/EbOLAA/cosFAA/GHeqlB/TM
> | >
> | > | -------------------------------------------------------------
----
> | ---~-
> | >
> | > | >
> | >
> | > |
> | >
> | > | Please note that this group is for discussion between users
only.
> | >
> | > |
> | >
> | > | To get support from AmiBroker please send an e-mail directly
to
> | >
> | > | SUPPORT {at} amibroker.com
> | >
> | > |
> | >
> | > | For other support material please check also:
> | >
> | > | http://www.amibroker.com/support.html
> | >
> | > |
> | >
> | > |
> | >
> | > | Yahoo! Groups Links
> | >
> | > |
> | >
> | > |     http://groups.yahoo.com/group/amibroker/
> | >
> | > |
> | >
> | > |     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> | >
> | > |
> | >
> | > |     http://docs.yahoo.com/info/terms/
> | >
> | > |
> |
> |
> |
> |
> | ------------------------ Yahoo! Groups Sponsor ------------------
--~--
> | >
> | Help tsunami villages rebuild at GlobalGiving. The real work
starts
> | now.
> | http://us.click.yahoo.com/njNroD/KbOLAA/cosFAA/GHeqlB/TM
> | -----------------------------------------------------------------
---~-
> | >
> |
> | Please note that this group is for discussion between users only.
> |
> | To get support from AmiBroker please send an e-mail directly to
> | SUPPORT {at} amibroker.com
> |
> | For other support material please check also:
> | http://www.amibroker.com/support.html
> |
> |
> | Yahoo! Groups Links
> |
> |
> |
> |




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS