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

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



PureBytes Links

Trading Reference Links

Bill,

ExRems operate on ENTIRE array regardless of what testing period you have choosen.
If you want to operate them only on selected period you need to use this that way:

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

Buy = Buy AND Status("barinrange"); // this filters out buy statements outside current range.

Short = Sell;  Cover = Buy;

Buy  = ExRem(Buy,Sell); Sell = ExRem(Sell, Buy);
Short = ExRem(Short, Cover); Cover = ExRem(Cover, Short);

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "Bill Barnard" <wbarnard@xxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 16, 2003 4:00 PM
Subject: [amibroker] Re: Problem with Equity Plot and Calculation - Tomasz


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



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/




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your HP at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5706&lp=home/hp.asp
http://us.click.yahoo.com/arYXfA/.xWGAA/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/