Trading Systems and Money Management : A Guide to Trading and Profiting in Any Market

(やまだぃちぅ) #1
SCT.ShortLoss = 1 + StopLossVar * 0.01;
SCT.LongTrailing = 1 - TrailStopVar * 0.01;
SCT.ShortTrailing = 1 + TrailStopVar * 0.01;
SCT.LongTarget = 1 + ProfTargVar * 0.01;
SCT.ShortTarget = 1 - ProfTargVar * 0.01;
End;
If EntryPrice > 0 Then Begin
If MaxBarsVar > 0 and BarsSinceEntry + 1 >= MaxBarsVar Then
SetExitOnClose;
If StopLossVar > 0 Then Begin
ExitLong ("SCT.L-Loss(P)") Next Bar at EntryPrice * SCT.LongLoss
Stop;
ExitShort ("SCT.S-Loss(P)") Next Bar at EntryPrice * SCT.ShortLoss
Stop;
End;
If TrailStopVar > 0 Then Begin
SCT.TrueLength = BarsSinceEntry + 1;
ExitLong ("SCT.L-Trail(P)") Next Bar at
Highest(High, SCT.TrueLength) * SCT.LongTrailing Stop;
ExitShort ("SCT.S-Trail(P)") Next Bar at
Lowest(Low, SCT.TrueLength) * SCT.ShortTrailing Stop;
End;
If ProfTargVar > 0 Then Begin
ExitLong ("SCT.L-Trgt(P)") Next Bar at EntryPrice * SCT.LongTarget
Limit;
ExitShort ("SCT.S-Trgt(P)") Next Bar at EntryPrice * SCT.ShortTarget
Limit;
End;
End;
End
{12} Code for stop type 2 (true-range stops).}
Else If StopTypeVar = 2 Then Begin
EP = EntryPrice;
If TrailStopVar <= 0 and EP <> EP[1] and EP > 0 Then Begin
SCT.TRLoss = AvgTrueRange(MaxBarsVar) * StopLossVar;
SCT.TRTrailing = AvgTrueRange(MaxBarsVar) * TrailStopVar;
SCT.TRTarget = AvgTrueRange(MaxBarsVar) * ProfTargVar;

CHAPTER 20 Adding Exits 223

Free download pdf