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

[amibroker] Contingent Stops w/Rotational Trading



PureBytes Links

Trading Reference Links

I am not very proficient in coding and wonder if anyone could give me
an assist with building a contingent stop.

Here's what I am trying to do.

Step 1: Enter the top ranked ETF based on a position score
PositionScore = Score;

My position scoring code is set up so that the score is either a
number positive or zero and then the best score is selected. (no
shorts allowed)

Step 2:  Hold for a minimum number of bars or days (i.e. a minimum
hold before rechecking the scoring)
HMB = Optimize("Hold Min Bars", 3, 3, 14, 1);
SetOption("HoldMinBars", HMB);

Step 3:  Exit the position based on the following in this order:

3.1.  Exit at a given trailing stop loss based on ATR
ATRMult = Optimize("ATR Setting", 3, 2, 5, .1 );
ApplyStop(stopTypeTrailing, stopModePoint, ATRMult*ATR(14), True, True );

3.2.  Exit at a given profit objective
ApplyStop( stopTypeProfit, stopModePercent, Optimize( "max. loss stop
level", 3, 2, 30, 1 ), True, ReEntryDelay = 1 );

Actually what I'd really like to do in step 3.2. is tighten up the
trailing stop loss when the % profit objective is reached. And, I
don't want to reenteer (see Step 4).

3.3.  Exit on the HoldMinBars setting if the current stock is not the
top ranked in the scoring code any longer

Step 4: Do not re-enter the last buy stock until a different one is
selected (i.e. there really is no reentry until it falls below the
highest score and then rises to the top again)

Anyway, my coding skills end with the above.  3.2 is not the way I
would like it and 4 I have no idea how to do.

Tks K




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

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

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