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

Re: [amibroker] Re: Barssince / Help



PureBytes Links

Trading Reference Links

Hi DT,

You are right, I just want either one of the condition happened then cover
to be activated. After checking, I confirm the barssince(short)==7 not
working as you can see there are covers more than 7 bars. For Nasdaq, you
can see that a short happened on 1/17/03 but a cover only happen on 3/20/03.
Could this because the barssince is return array and the type is mismatch
???

Thanks
KK

Following is the AFL code I use.

// For futures use
MarginDeposit = 5000;
file://PositionSize = -30;// use 80% of equity
PositionSize = 1 * 8000;// limit to maximum contracts
RoundLotSize = 1;
PointValue = 100;

Short=Open>Close AND Close<EMA(Close,50);
Cover=BarsSince(Short)==7 AND Close>Ref(High,-1);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);


Filter= Short OR Cover;

AddColumn(Close,"close",1.2);
AddColumn(ShortPrice,"shortprice",1.2);
AddColumn(Short,"short");
AddColumn(Cover,"cover");
AddColumn(BarsSince(Short),"bar");
AddColumn(BarsSince(Short)==7,"barc");
AddColumn(Close>Ref(H,-1),"c");

----- Original Message -----
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 23, 2003 5:25 PM
Subject: [amibroker] Re: Barssince / Help


> Your condition is just fine.
> [try Cover=BarsSince(Short)==7 ; to confirm that it works]
> But, if  Close>Ref(High,-1) comes before the 7th bar after Short, it
> is activated first.
> For ^NDX there is a [rare] example between 2/2/2001 and 13/2/2001,
> when Close>Ref(High,-1) did not happened any of the 7 bars and
> BarsSince(Short)==7 was activated first.
> You join with OR your Cover conditions, which means you search for
> ANY true, not for both.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "kk2628" <kk2628@xxxx> wrote:
> > HI,
> >
> > I intend to cover my short on the 7th bar after my short or if the
> close today higher than yesterday high. My AFL is as below
> > short = close<ema(close,50);
> > Cover=BarsSince(Short)==7 OR Close>Ref(High,-1);
> >
> > However, when I check the result, seems only the second condition
> close>ref(high,-1) will be execute, the first condition barssince not
> taking effect. Any help is appreciated.
> >
> > Thanks
> > KK
>
>
>
> 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 No Snore & Get a Good Night's Sleep. Natural Oral Spray -- $24.95
(1 bottle, 1 month supply, with sweet almond oil, eucalyptus oil & more).
http://www.challengerone.com/t/l.asp?cid=2881&lp=h515.html
http://us.click.yahoo.com/2oMABA/nuYGAA/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/