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 [email protected], "Dave Merrill" <[EMAIL PROTECTED]> 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 >
