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

[amibroker] Re: Problem with Equity Plot and Calculation - Tomasz



PureBytes Links

Trading Reference Links

Fred,

The ExRems must be removed to make it work from the first bar even 
after the code is changed from the Cross statement, which provides a 
1-day only "true" condition, to the "greater than" statement, which 
provides an ongoing "true" condition. At least that is what I found 
when I tried it. The code:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//Buy = Cross(Close, (1 + 0.002)*EMA(Close, 40));
//Sell = Cross((1 - 0.002)*EMA(Close, 40), Close);
Buy = Close > (1 + 0.002)*EMA(Close, 40);
Sell = (1 - 0.002)*EMA(Close, 40) > Close;
Short = Sell;  Cover = Buy;
Buy  = ExRem(Buy,Sell); Sell = ExRem(Sell, Buy); 
Short = ExRem(Short, Cover); Cover = ExRem(Cover, Short);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
did not make the Equity calc and plot start on the first day of 
the test, but it did work after taking out the ExRems.

The reason this is a big deal to me, and I don't just push the start 
window back to the previous signal, is that I am working on a system 
which does an iterative optimization routine and walks it forward. 
Thus, there are internally very many different sets of Cross dates, 
which need to be handled within the loops, and the accuracy of the 
calcs is considerably impacted by the equity calc not starting at the 
chosen starting date.

Thanks for your help.

Bill


> It's NOT the ExRem's that are the culprits here as they would not 
> have reduced the signals from a crossover condition anyway as the 
x/o 
> only occurs on one bar.
> 
> I'm not sure why you seem to find this objectionable but in this 
> particular case why not just push the start window back to 2/20 ?
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Bill Barnard" <wbarnard@xxxx> 
> wrote:
> > Fred,
> > 
> > I appreciate your explanation. T changed the "Buy = Cross(A, B)" 
> type 
> > of statement to "Buy = A > B" and removed the "ExRem" statements, 
> and 
> > Voila! - the Equity plot begins "Short" on 2/23/01, as desired.
> > 
> > Now I am going to have to think about this some more. I have been 
> > routinely using the ExRem statements after the Buy and Sell 
> > assignments, thinking that it is always desirable to remove the 
> > redundant signals. Now I see that this is not necessarily the 
case.
> > 
> > Thanks so much for providing the answer to my dilemma. Now I will 
> > have to rework many of my afls to make them start properly at the 
> > beginning of the test period.
> > 
> > Bill
> > 
> > 
> > 
> > > Your system as written is looking for a CROSS to occur.  That 
> CROSS 
> > for
> > > RUT-I took place on 2/20/2001 (See Attachment).  Therefore with 
a 
> > start
> > > date of 2/23/2001 there is NO signal in play until the one in 
> April
> > > (See Attachment).  Therefore there is no equity gain/loss to 
> show. 
> > > Ergo the menaing of OUT in the AA list and report.
> > > 
> > > Fred


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Purchase the perfect DVD player for your home
and receive a $20 gift card.
Weżll even ship your DVD player to you for free.
http://us.click.yahoo.com/7b_kdA/A_WGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/