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

RE: [amibroker] Applystop again



PureBytes Links

Trading Reference Links

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

|

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

|

 



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