PureBytes Links
Trading Reference Links
|
Walt - is there any way to program a sell/cover at mkt close order
for backtesting? I tried the following from your code but the
backtest feature doesn't recognize the 'sell/cover' signals I put
in :-(
//IF X=1 THEN Buy Next Bar AT H+.05 STOP;
> buy=ref(x,-1);
> buyprice=ref(h+.05,-1);
sell=ref(x,-1);
sellprice=ref(close,-1);
> //IF Y=1 THEN Sell Short Next Bar AT L-.05 STOP;
> sell=ref(y,-1);
> shortprice=ref(l-.05,-1);
cover=ref(y,-1);
coverprice=ref(close,-1);
--- In amibroker@xxxxxxxxxxxxxxx, "hairy_mug" <WSCHWARZ@xxxx> wrote:
>
> This should get you started;
>
> R=(H-L)/10;
>
> //IF C>H-((R/10)) AND O<L+((R/10)) THEN X=1 ELSE X=0;
> x=iif(C>H-((R/10)) AND O<L+((R/10)),1,0);
>
> //IF C<L+((R/10)) AND O>H-((R/10)) THEN Y=1 ELSE Y=0;
> y=iif(C<L+((R/10)) AND O>H-((R/10)),1,0);
>
> //IF X=1 THEN Buy Next Bar AT H+.05 STOP;
> buy=ref(x,-1);
> buyprice=ref(h+.05,-1);
>
> //IF Y=1 THEN Sell Short Next Bar AT L-.05 STOP;
> sell=ref(y,-1);
> shortprice=ref(l-.05,-1);
>
>
> As for the other stops, look at "applyStops" function...
> >>> Realize, AMI does not interface with any broker (except IB)
> and you need to submit the actual orders & stops yourself...
>
> Walt
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Dickie Paria" <babui@xxxx> wrote:
> >
> >
> > The following strategy - in EasyLanguage - is from Xavier Raj's
> > article in the Apr 2005 edition of Active Trader. The strategy
is
> > simple and looks promising. Being an ABSOLUTE newbie to AFL, I'm
> > having trouble translating the EasyLanguage to AFL. I would
> > appreciate if somebody would help. I'll list the EasyLanguage
code
> > first followed by my pathetic attempt
> >
> > Xavier Raj's system
> > VAR:X(0),Y(0),R(0); R=RANGE;
> >
> > IF C>H-((R/10)) AND O<L+((R/10)) THEN X=1 ELSE X=0;
> > IF C<L+((R/10)) AND O>H-((R/10)) THEN Y=1 ELSE Y=0;
> > IF X=1 THEN Buy Next Bar AT H+.05 STOP;
> > IF Y=1 THEN Sell Short Next Bar AT L-.05 STOP;
> > Sell this Bar AT C;
> > Buy to Cover This Bar AT C;
> > Sell Next Bar AT MEDIANPRICE-.05 STOP;
> > Buy to Cover Next Bar AT MEDIANPRICE+.05 STOP;
> > Sell AT ("P1") Next Bar H+10 LIMIT;
> > Buy to Cover AT ("P2") Next Bar L-10 LIMIT;
> >
> > Having just finished understanding pg 246 of the Users Guide, my
> > limited AFL language skills couldn't grasp the finesse of
> > writing 'buy next bar' and 'medianprice'. Anyway, here's my
simple
> > attempt (too many 'results' and 'conditions'). Please HELP!!
> >
> > R=(H-L)/10;
> >
> > Condition1 = Close>High-((R/10)) AND Open<Low+((R/10));
> > Condition2 = Close<Low+((R/10)) AND Open>High-((R/10));
> >
> > result1 = IIf(Condition1,1,0);
> > result2 = IIf(Condition2,1,0);
> >
> > Buy = H+0.05;
> > Sell = Close;
> > Short = L-0.05;
> > Cover = Close;
> >
> > Condition3 = result1 = 1;
> > Condition4 = result2 = 1;
> >
> > IIf (Condition3,Buy,0);
> > IIf (Condition4,Short,0);
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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/
|