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

Re: [amibroker] Problem with AddToComposite



PureBytes Links

Trading Reference Links

Hello Tomasz,

Thansk for the clarification here.

I have discovered what is going on and it is as follows.

I am in an existing trade (say a Long) and exit will be next day on open.

Next day signals a new position also Long.

I expect first position to be closed out with a sell and a new position
instigated with a buy at open.

Program decides that it can save brokerage by cancelling out the ordersso
open Long remains open?

Problem is that (the new position which is still the old one!)KEEPS the old
Stop figure and is stopped out at the wrong place. The stop is referencing
the prior days stop an dnot the new position stop.

Any suggestion to make the program do the intended thing here?

Regards,

Red



-----Original Message-----
From: Tomasz Janeczko [mailto:amibroker@xxxxxx]
Sent: Tuesday, 22 June 2004 6:28 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Simple system not producing expected results.


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



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/