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

Re: Pullback System # 1 - problem with BuyPrice



PureBytes Links

Trading Reference Links

Tomasz:

There's also a problem with buy signal redundancy in this code 
sequence that causes erronous sell calculations...

This was raised earlier on the list in a thread between you and Ralf 
earlier.

In following code sequence...

> buyp = valuewhen( buy, open,1);
> sell = c > buyp or l < ref(llv(l,2),-1);
> buy = exRem(buy,sell);
> sell = exRem(sell,buy);

...sell is dependent on buyp which is dependent on buy which means 
sell is dependent on buy. Because of this linkage, the sell can be 
incorrectly calculated when there are redundant buys prior to a sell 
signal. The redundant buys (which are not removed by exRem until 
AFTER the sell assignment) can cause the buyp to change from the 
CORRECT buyp.

The only remedy that I see is to use Jscript to make the correct sell 
calculation by deleting redundant buys and preserving the correct 
buyp in the process of making the sell assignment (not after).

Thanks and best regards,
Jim

--- In amibroker@xxxx, "Tomasz Janeczko" <tj@xxxx> wrote:
> Hello again,
> 
> One more detail: 
> the use of buyprice variable in the formula in question
> does not affect system results but only affects
> buy/hold results.
> This is because buy/hold uses also buyprice array
> and this array has undefined value for the start
> bar because of 
> buyprice = valuewhen( buy, open,1);
> 
> (the first bar when buyprice is defined after such statement
> is the bar when first buy ocurred)
> 
> Best regards,
> Tomasz Janeczko
> ===============
> AmiBroker - the comprehensive share manager.
> http://www.amibroker.com
> 
> 
> ----- Original Message ----- 
> From: "Tomasz Janeczko" <tj@xxxx>
> To: "AmiBroker Mailing List" <amibroker@xxxx>
> Sent: Friday, July 06, 2001 10:57 PM
> Subject: [amibroker] Pullback System # 1 - problem with BuyPrice
> 
> 
> > Hello,
> > 
> > There is a problem with the Pullback System # 1
> > formula from AFL library that causes wrong results
> > when back-tested on AmiBroker 3.59 and above 
> > (the versions supporting *price variables ):
> > 
> > The problem is that the formula 
> > uses reserved variable BuyPrice in a wrong way.
> > As it is written in the tutorial section of the guide
> > BuyPrice controls the price at which the long trade is open.
> > 
> > To fix the formula you should use different name for the
> > variable than BuyPrice - for example buyp as shown in the fixed
> > formula below:
> > 
> > condition1 = ref(c,-2) < ref(c,-3) and ref(c,-1) < ref(c,-2);
> > condition2 = h > ref(h,-1);
> > filter = c > ma(c,50);
> > 
> > buy = condition1 and condition2 and filter;
> > buyp = valuewhen( buy, open,1);
> > sell = c > buyp or l < ref(llv(l,2),-1);
> > 
> > buy = exRem(buy,sell);
> > sell = exRem(sell,buy);
> > 
> > 
> > Best regards,
> > Tomasz Janeczko
> > ===============
> > AmiBroker - the comprehensive share manager.
> > http://www.amibroker.com
> > 
> > 
> > 
> > 
> > 
> > 
> > Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 
> > 
> > 
> >