PureBytes Links
Trading Reference Links
|
better gif
----- Original Message -----
From: "Abhijit Dey" <omegalist@xxxxxxxxxx>
To: "OmegaList" <omega-list@xxxxxxxxxx>
Sent: Wednesday, October 13, 2004 15:20
Subject: Array input to a strategy?
> I am modifying a strategy to scale out it's position. I want to enter
> a) number of contracts to enter the trade with, and
> b) scale out n1 contracts as target t1, {n2, t2} and so on.
>
> a) is easy. How to do b? Even if not possible directly, there must be a
> workaround like so many other stuff with TS.
here's my experiment with bollinger bands, can get the first order and the
exit but not the scale in
Input: Price(Close), Length(21),
StdDev#1(1), StdDev#2(2),
Outside(.03){decimal form of percent};
Variables: BBTop1(0), BBBot1(0),
BBTop2(0), BBBot2(0),
MP(marketposition);
BBTop1 = BollingerBand(Price, Length*.618, StdDev#1);
BBBot1 = BollingerBand(Price, Length*.618, -StdDev#1);
BBTop2 = BollingerBand(Price, Length, StdDev#2);
BBBot2 = BollingerBand(Price, Length, -StdDev#2);
{Begin Long scale; buy x contracts as the price moves below the bottom line
"BBBot2"}
If MP=0 and Close <= (1-outside)*BBBot2 then
Buy ("BB2")1 contract next bar at market;
{Buy one more contract as we close over the next level, line "BBbot1", and
bring the stop up to the bottom line "BBBot2"}
If MP=1 and Close crosses over BBBot1 then
begin
Buy ("BB1")1 contract at market;
Exitlong ("XBBs2")2 contract at BBbot2 stop;
end;
If MP=2 and Close crosses over BBtop1 then Exitlong ("XBB1")1 contract at
BBbot1 stop;
If Close >= BBtop2 then Exitlong("XBBall") at market;
Attachment:
bbtest.gif
Description: GIF image
|