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

[amibroker] Van Tharp trading exits



PureBytes Links

Trading Reference Links

Has anybody already coded Van Tharps suggested Exits as follows:

1. Initial stop - entry price minus three-times-volatility (3* 10 Day ATR)

2. Second, - whenever the market moves twice the daily volatility from
yesterday's close against you in a single Day (2 * Avg 10 Day ATR)

3. Lastly, a 4-R profit will after a 4-R profit is triggered, your
trailing volatility stop moves up to 1.6 times the average True range
(i.e., instead of 3 times).

I have the following for the AFL code for 1 and 2:

//1. Initial stop
ApplyStop( stopTypeLoss, stopModePoint, 3 * ATR( 10 ), True );

//2. Second stop
Sell = (Ref(C,-1) - C > 2 * ATR(10));

I'm not sure how to calculate the last exit (3. 4-R profit)?
If I give buyprice = ... same as buy formula, how do I keep the value
of (3 * ATR(10)) at the time the buy occurs to calculate initial risk?

Thanks


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

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