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

[amibroker] Exit Price at High with ApplyStop() profit target



PureBytes Links

Trading Reference Links

To AppyStop() veterans I'm sure this one seems easy.  To this
newbie it's somewhat puzzling. :)

ApplyStop() is used for loss, profit and time exits in a long-only system
that enters on a limit price.  Exits are intraday.

Backtest results in AA show buy prices are at the limit price as expected.

NBars exits in the AA results are correct.

Profit exits are at the High of the exit bar, not correct.  I want
profit exits at the profit target price, which is always lower than
the High of the bars in question.

In code below, profittargetpct and stoppct are both expressed in the
same units, e.g. 10 is 0.10 is 10%. 

What am I missing?

////////////////////////////////////////
ApplyStop( stopTypeProfit, stopModePercent, profittargetpct,
ExitAtStop=1, volatile = False, ReEntryDelay = 0 );
ApplyStop( stopTypeLoss, stopModePercent, stoppct, ExitAtStop,
volatile = False, ReEntryDelay );
ApplyStop( stopTypeNBar, stopModeBars, timeoutbars, ExitAtStop=0,
volatile = False, ReEntryDelay ); // lower priority


// entry and exit rules
el = ( Low < limitlongprice );
es = 0;
xl = ( osc_prior >= oscsellthresh );
xs = 0;


// buy and sell vectors
Buy = el;
BuyPrice = limitlongprice;

Sell = xl;
SellPrice = ( 1 + profittargetpct/100 ) * limitlongprice;

// system is long-only
Short = 0;//es;
ShortPrice = 0;

Cover = 0;//xs;
CoverPrice = 0;
////////////////////////////////////////


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

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