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

Re: [amibroker] Code help requested - Control length of trade



PureBytes Links

Trading Reference Links


Ken,
 
Thanks for bringing me back to that   
"    <SPAN 
class=900054615-21042002>sell = Ref(Buy,-20)    <FONT 
face=Arial color=#000000>"  I had tried it previously but something I had 
done was blocking it.  The 
sell = Ref(Buy,-20)   <FONT 
color=#000000>statement works for me sometimes and then not at other 
times. <FONT 
face=Arial size=2><SPAN 
class=900054615-21042002>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
<FONT face=Arial 
color=#000000><SPAN 
class=900054615-21042002> 
<FONT face=Arial 
color=#000000><SPAN 
class=900054615-21042002>Greg
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Ken Close 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
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
<SPAN 
class=900054615-21042002> 
sell= 
Ref(Buy,-20) rather than what you tried sell = 
Ref(Buy,20);
<SPAN 
class=900054615-21042002> 
Did you ever 
try this?
<SPAN 
class=900054615-21042002> 
<SPAN 
class=900054615-21042002>Ken
<FONT face=Tahoma 
size=2>-----Original Message-----From: greg 
[mailto:greg.bean@xxxx]Sent: Sunday, April 21, 2002 
10:02 AMTo: <A 
href="">amibroker@xxxxxxxxxxxxxxxSubject: 
Re: [amibroker] Code help requested - Control length of 
trade
Hi,
 
I think I've got it now. My use of <FONT 
color=#0000ff size=1>ExRem was 
messing me up. 
 
This seems to work ok.
 

/* MI Screens BackTest*/<FONT 
color=#008000 size=1>
//Buy at open 
on first Monday Of Month //<FONT 
color=#000000 size=1>
Buyday = DayOfWeek<FONT 
color=#000000 size=1>()==<FONT face="Courier New" color=#ff00ff 
size=1>1 AND <FONT 
color=#0000ff size=1>Day()<FONT 
face="Courier New" color=#000000 size=1>>=<FONT face="Courier New" 
color=#ff00ff size=1>1 
AND <FONT face="Courier New" color=#0000ff 
size=1>Day<FONT face="Courier New" color=#000000 
size=1>()<=<FONT face="Courier New" color=#ff00ff 
size=1>7; <FONT color=#008000 
size=1>// buy on Monday<FONT face="Courier New" color=#000000 
size=1>
//Sell on Friday, 4 weeks after buy//<FONT face="Courier New" 
color=#000000 size=1>
Sellday = <FONT face="Courier New" color=#0000ff 
size=1>DayOfWeek<FONT face="Courier New" color=#000000 
size=1>()==5<FONT 
face="Courier New" color=#000000 size=1> AND <FONT 
face="Courier New" color=#0000ff size=1>Day<FONT face="Courier New" 
color=#000000 size=1>()>=<FONT face="Courier New" color=#ff00ff 
size=1>21 AND 
Day<FONT 
face="Courier New" color=#000000 size=1>()<=<FONT face="Courier New" 
color=#ff00ff size=1>31<FONT face="Courier New" color=#000000 
size=1>;//sell on 
friday
Buy=Buyday 
;
Sell= 
Sellday; <FONT color=#008000 
size=1>// sell on Friday 20 days after buy<FONT color=#000000 
size=1>
 
//ApplyStop(2,3,Optimize("TrailingStop",15,0,20,5),1);
 
Greg
 
 
 
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A title=greg.bean@xxxx 
href="">greg 
To: <A title=amibroker@xxxxxxxxxxxx 
href="">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). 

<FONT face=Arial 
size=2>               
sell = barssince(buy)=20
 
and various other tthings, but I'm getting 
nowhere.
 
Here's what I've got so far.
 

/* MI Screens BackTest*/<FONT color=#000000 
size=1>
//Buy at open 
on first Monday Of Month 
//
Buyday = DayOfWeek<FONT 
color=#000000 size=1>() == 1<FONT 
color=#000000 size=1>; // buyon 
Monday<FONT 
face="Courier New" color=#008000 size=1>
//Sell on Friday, 4 weeks after buy//<FONT face="Courier New" 
color=#000000 size=1>
Sellday = <FONT face="Courier New" color=#0000ff 
size=1>DayOfWeek<FONT face="Courier New" color=#000000 
size=1>()==<FONT face="Courier New" color=#ff00ff 
size=1>5;<FONT 
face="Courier New" color=#008000 size=1>//sell on friday<FONT 
color=#000000 size=1>
Buy=Buyday <FONT face="Courier New" color=#000000 
size=1>;
Sell=<FONT face="Courier New" color=#000000 
size=1>Sellday+<FONT face="Courier New" color=#ff00ff 
size=1>20; <FONT color=#008000 
size=1>// sell on Friday 20 days after buy
<FONT color=#008000 
size=1>//ApplyStop(2,3,Optimize("TrailingStop",15,0,20,5),1);<FONT 
color=#000000 size=1>
Buy=ExRem<FONT color=#000000 
size=1>(Buy,Sell);
Sell=ExRem<FONT 
color=#000000 size=1>(Buy,Sell);
 
 Your use of 
Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.