PureBytes Links
Trading Reference Links
|
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
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>;//sellon
friday
Buy=Buyday
;
Sell=
Sellday; //
sell on Friday 20 days after buy
//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@xxxxxxxxxx
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 moresimple:(
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=#008000 size=1>
//Buy at open
on first Monday Of Month //<FONT
color=#000000 size=1>
Buyday = DayOfWeek<FONT
color=#000000 size=1>() == 1<FONT
color=#000000 size=1>; // buy on
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>()==5<FONT
face="Courier New" color=#000000 size=1>;<FONT face="Courier New"
color=#008000 size=1>//sell on friday
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.
|