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

Re: [amibroker] Re: Is there a way to exit unprofitable trades after a certain number of bars?



PureBytes Links

Trading Reference Links

ExRemSpan(Buy, #holdbars) for Buy signals with ExRem(Sell, Buy) for Sell signals might get around 
the Catch-22.
GRANT

gp_sydney wrote:
> Due to the way array maths works, you can't normally use operations of
> the form:
> 
> <exitCondition> = BarsSince(<entryCondition>);
> 
> This is because the entry array will likely have more signals than
> will ultimately be used once the exit array is defined (ie. there will
> likely be entry signals ignored because there's already a trade in
> progress), and BarsSince() will always be from the most-recent entry
> signal, even if it's one that's ultimately ignored. The first thought
> is usually to remove the excess entries with ExRem(), but you can't do
> that until after the exit array has been defined, so you have a
> Catch-22 situation.
> 
> For iterative operations like this, you need to use a loop and work
> through the arrays bar by bar, so that you can both create the exit
> array and remove excess entry signals at the same time.
> 
> So you don't need to use the CBT, just a loop.
> 
> GP
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "trustdnb" <trustdnb@xxx> wrote:
>> Is there a way to exit unprofitable trades after a certain number of
>> bars without using the CBT?  Essentially what I want is an Nbar stop
>> that only triggers on unprofitable trades, without stopping winners.
>>
>> My weak attempt did not work:
>>
>> Short = /*short fomula */;
>> ShortExit = BarsSince(Short) > 12 AND C >= ValueWhen(Short, C); 
>> Cover = ShortExit;
>>
> 
> 
> 
> ------------------------------------
> 
> 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 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
> 
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date: 8/19/2008 6:53 PM
> 
> 
> 

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

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