PureBytes Links
Trading Reference Links
|
Hello,
There is in fact one (quite common :-) ) coding error in your formula:
you have used assignment instead of equality check:
Was:
> EqualOpenLow= IIf(Open = Ref(Low,-1),1,0);
> EqualOpenHigh= IIf(Open = Ref(High,-1),1,0);
Should be:
EqualOpenLow= IIf(Open == Ref(Low,-1),1,0);
EqualOpenHigh= IIf(Open == Ref(High,-1),1,0);
Note == (equality check) vs. = (assignment)
By the way there is no need to use IIF since equality check operator already gives 1 or 0.
So it can be simplified to:
EqualOpenLow= Open == Ref(Low,-1); // this equality check already gives 1 or 0
EqualOpenHigh= Open == Ref(High,-1); // this equality check already gives 1 or 0
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "Collectable Images" <telecard@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, June 22, 2004 9:46 AM
Subject: [amibroker] Simple system not producing expected results.
> At the risk of being short down in flames. :-)
>
> I discovered a problem in my own code of one of my systems so I decided to
> test a very simple idea to see why it was happening.
>
> The Buy rule is buy when todays open is equal to yesterdays low or high
> price.
>
> Sell day after entry.
>
> The following code produces open positions that go for months, most that are
> only one day and millions entries are never when open opens at low or high.
>
>
>
> EqualOpenLow= IIf(Open = Ref(Low,-1),1,0);
> EqualOpenHigh= IIf(Open = Ref(High,-1),1,0);
>
> Buy = EqualOpenLow;
> Sell = BarsSince(Buy==1);
> SetTradeDelays(0,0,0,0);
>
>
> Short = EqualOpenHigh;
> Cover = BarsSince(Short==1);
> SetTradeDelays(0,0,0,0);
>
>
>
> Result on DD for period 16/01/2001 to 18/6/2004 is;
>
> Entry 4/10/2002 and exit 11/12/2003
>
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|