ShortTotStrength.2, ShortTotStrength.3, ShortTotStrength.4, ShortTotStrength.5);
LongTermTrueRange = AvgTrueRange(LongTermTRLookback);
ShortTermTrueRange = AvgTrueRange(ShortTermTRLookback);
If MarketPosition = 0 Then Begin
If AllowLong = True and LongTotStrength.1 >= MinLongStrength and
LongTermTrueRange > ShortTermTrueRange Then
Buy ("L-May 01") NumCont Contracts Next Bar at Market;
If AllowShort = True and ShortTotStrength.1 <= MaxShortStrength and
LongTermTrueRange < ShortTermTrueRange Then
Sell ("S-May 01") NumCont Contracts Next Bar at Market;
End;
If EntryPrice > 0 Then Begin
ExitLong ("L-Stop") Next Bar at EntryPrice –
(ShortTermTrueRange * LongStopMulti) Stop;
ExitLong ("L-Trgt") Next Bar at EntryPrice +
(ShortTermTrueRange * LongTargetMulti) Limit;
ExitShort ("S-Stop") Next Bar at EntryPrice +
(ShortTermTrueRange * ShortStopMulti) Stop;
ExitShort ("S-Trgt") Next Bar at EntryPrice –
(ShortTermTrueRange * ShortTargetMulti) Limit;
End;
{Code for initial market export goes here, with Normalize(True). Set
ExportSwitch(True).}
{Code for testing robustness goes here (see Part 3 of book), with Normalize(True).
Set RobustnessSwitch(True).}
{Code for exporting results for money management analysis goes here (see Part 4
of book), with Normalize(False). Set MoneyExport(True).}
152 PART 2 Trading System Development