by multiplying the average number of trades per market by the average profit per
trade and market. For the original system, this value comes out to $64,750 (1,295
* 50), but with the latest version of the system, traded from both sides, the aver-
age net profit per market comes out to $85,932 (308 * 279). We will carry this ver-
sion with us for further testing in Parts 3 and 4. Figure 14.1 shows a few sample
trades in Citigroup during the winter of 2001–2002.
TradeStation Code
Variables:
{These variables can also be used as inputs for optimization purposes.}
AllowLong(True), AllowShort(True), PercentTarget(3), PercentLoss(1),
{Leave these variables alone.}
ProfitTarget(0), StopLoss(0), LongProfit(0), LongStop(0), ShortProfit(0),
ShortStop(0);
{Code for normalizing the number of contracts traded goes here.}
If BarNumber = 1 Then Begin
ProfitTarget = PercentTarget * 0.01;
StopLoss = PercentLoss * 0.01;
End;
If MarketPosition = 0 Then Begin
If AllowLong = True and Low < Low[2] and Low[1] < Low[2] Then
Buy ("L-Nov 01") NumCont Contracts Next Bar on High[2] Stop;
If AllowShort = True and High > High[2] and High[1] > High[2] Then
Sell ("S-Nov 01") NumCont Contracts Next Bar on Low[2] Stop;
End;
If EntryPrice > 0 Then Begin
LongProfit = EntryPrice * (1 + ProfitTarget);
LongStop = EntryPrice * (1 - StopLoss);
ShortProfit = EntryPrice * (1 - ProfitTarget);
ShortStop = EntryPrice * (1 + StopLoss);
If MarketPosition = 1 Then Begin
ExitLong ("L-Stop") Next Bar at LongStop Stop;
ExitLong ("L-Trgt") Next Bar at LongProfit Limit;
End;
If MarketPosition = -1 Then Begin
ExitShort ("S-Stop") Next Bar at ShortStop Stop;
ExitShort ("S-Trgt") Next Bar at ShortProfit Limit;
CHAPTER 14 Harris 3L-R Pattern Variation 171