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

[amibroker] Re: Question regarding the "Equity()" function



PureBytes Links

Trading Reference Links

Hi, sorry to bump a very old thread, but I encountered this very issue
today again, so I was wondering if anybody has any insight.
Previously I saw a post where it listed the correct order as

1. BUY, SELL, SHORT, COVER statements
2. Equity(1) statement
3. Position size statements
4. Profit/Loss calculations

I think this needs to be clarified more, at least this wasn't the
order I found to work, or perhaps somebody has insight into where
exactly an Equity(1) statement needs to be placed (or avoided) to get
correct results. In tinkering with some code of mine, I found out the
bug was the placement of Equity(1). If it was placed in one place,
then trailing stops would work. If it was placed in another, trailing
stops would work most of the time but not work in others. Is there
some clear-cut logic as to where this statement fits into AFL? It's
rather disconcerting to find out, as the original author noted, you
can have a formula succeed or fail purely based on the position of
this statement.

--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxx> wrote:
>
> not sure there are enough details here to understand your issue, but
I'll
> give it a shot.
> 
> as described in the help for the Equity function, Equity(1) changes the
> buy/sell/short/cover arrays, so it may change trading results generated
> after it's called.
> 
> in general, you don't need to use Equity() at all. the only reasons I'm
> aware of would be if you wanted to display trade arrows in an
indicator and
> wanted the effect of stops taken into account, or if you wanted to
use the
> result of the function, ie, past trading performance under certain
> conditions, to make trading decisions (equity feedback).
> 
> hth,
> 
> dave
>   Could someone please offer some assistance
>   regarding the proper placement and use of the
>   Equity() function.
> 
>   I usually place Equity(1) at the end of my Buy/Sell
>   statements in order to refresh and update the arrays.
> 
>   Probelm is, when I place Equity(1) in one area,
>   I get backtest results of $115,000.
> 
>   If I move it down a few lines (Befor my Exrem statements)
>   I get a profit of -32,000 ????
> 
>   Movet it somewhere else and get $14,000. ???
> 
>   So, until I understand where this statement should
>   be placed, I can't trust my results.
> 
>   Thanks everyone,
> 
>   Gosub283
>




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/