PureBytes Links
Trading Reference Links
|
Greg- When you have the potential for multiple signals, the best way
to control trade length is with the ExRemSpan function that Tomasz
recently introduced. The function syntax is explained in the beta
notes. Here's an example. Let's say you always want to sell after 10
bars.
Buy = Your buy rules;
Buy = ExRemSpan(Buy, 10);
Sell = Ref(Buy, -10);
Mark
--- In amibroker@xxxx, "greg" <greg.bean@xxxx> wrote:
> Ken,
>
> Thanks for bringing me back to that " sell = Ref(Buy,-20) "
I had tried it previously but something I had done was blocking it.
The sell = Ref(Buy,-20) statement works for me sometimes and then
not at other times. I've got to leave this for awhile, and think about
it later. I can't think anymore at this point.Thanks for your help
>
> Greg
> ----- Original Message -----
> From: Ken Close
> To: amibroker@xxxx
> Sent: Sunday, April 21, 2002 12:47 PM
> Subject: RE: [amibroker] Code help requested - Control length of
trade
>
>
> Greg: I was thinking that your original statement
>
> sell = Ref(Buy,-20) rather than what you tried sell = Ref(Buy,20);
>
> Did you ever try this?
>
> Ken
> -----Original Message-----
> From: greg [mailto:greg.bean@x...]
> Sent: Sunday, April 21, 2002 10:02 AM
> To: amibroker@xxxx
> Subject: Re: [amibroker] Code help requested - Control length of
trade
>
>
> Hi,
>
> I think I've got it now. My use of ExRem was messing me up.
>
> This seems to work ok.
>
> /* MI Screens BackTest*/
>
> //Buy at open on first Monday Of Month //
>
> Buyday = DayOfWeek()==1 AND Day()>=1 AND Day()<=7; // buy on
Monday
>
> //Sell on Friday, 4 weeks after buy//
>
> Sellday = DayOfWeek()==5 AND Day()>=21 AND Day()<=31;//sell on
friday
>
> Buy=Buyday ;
>
> Sell= Sellday; // sell on Friday 20 days after buy
>
>
>
> //ApplyStop(2,3,Optimize("TrailingStop",15,0,20,5),1);
>
>
>
> Greg
>
>
>
>
>
>
>
> ----- Original Message -----
> From: greg
> To: AmiBroker@xxxx
> Sent: Sunday, April 21, 2002 10:12 AM
> Subject: [amibroker] Code help requested - Control length of
trade
>
>
> Hi,
>
> Been trying a few things for the past 3 hours but can't seem to
get it right. Please help before I get divorced :) .
> Trade Rules:
>
> 1. Buy at open on first monday of month.
> 2. Sell at open on Friday 4 weeks later (sell after 28 days).
That's sell after 20 bars . I think ?
>
> Pretty simple. But I guess I'm even more simple:(
>
> I've tried sell=ref(buy,20).
> sell = barssince(buy)=20
>
> and various other tthings, but I'm getting nowhere.
>
> Here's what I've got so far.
>
> /* MI Screens BackTest*/
>
> //Buy at open on first Monday Of Month //
>
> Buyday = DayOfWeek() == 1; // buy on Monday
>
> //Sell on Friday, 4 weeks after buy//
>
> Sellday = DayOfWeek()==5;//sell on friday
>
> Buy=Buyday ;
>
> Sell=Sellday+20; // sell on Friday 20 days after buy
>
> //ApplyStop(2,3,Optimize("TrailingStop",15,0,20,5),1);
>
> Buy=ExRem(Buy,Sell);
>
> Sell=ExRem(Buy,Sell);
>
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
|