SCT.ArrayPosition(0), SCT.WinTrades(0), SCT.SumSqProfit(0),
SCT.TestString(""), SCT.FileString("");
{3} Arrays:
SCT.TradeProfit[2000](0);
{4} If BarNumber = 1 Then Begin
If AllowLong = True Then
SCT.TradeType = "Long";
If AllowShort = True Then
SCT.TradeType = "Short";
If AllowLong = True and AllowShort = True Then
SCT.TradeType = "Both";
SCT.NameLength = StrLen(GetStrategyName) - 6;
If StopTypeVar = 1 Then
SCT.StopType = "Perc-"
Else If StopTypeVar = 2 Then
SCT.StopType = "TR-";
SCT.FileString = "D:\BookFiles\" + SCT.StopType + "Test - " +
RightStr(GetStrategyName, SCT.NameLength) + " - " +
RightStr(NumToStr(CurrentDate, 0), 4) + ".csv";
{SCT.TestString = "Market" + "," + "Direction" + "," + "Test Run" + "," +
"Stop Loss" + "," + "P-Target" + "," + "Trail Stop" + "," + "Max Bars" +
"," + "Avg Trade" + "," + "StDev Prof" + "," + "No Trades" + "," + "Perc
Win" + NewLine;
FileAppend(SCT.FileString, SCT.TestString);}
End;
{5} NoTradesVar = TotalTrades;
SCT.MarketPos = MarketPosition;
If NoTradesVar > NoTradesVar[1] Then Begin
If MarketPosition(1) = 1 Then
SCT.PosProfit = (ExitPrice(1) - EntryPrice(1)) / EntryPrice(1);
If MarketPosition(1) = -1 Then
SCT.PosProfit = (EntryPrice(1) - ExitPrice(1)) / EntryPrice(1);
SCT.TradeProfit[SCT.SetArrayPos] = SCT.PosProfit;
SCT.SetArrayPos = SCT.SetArrayPos + 1;
End;
{6} If LastBarOnChart Then Begin
{Alt: If LastCalcDate = Date + 1 Then Begin}
CHAPTER 20 Adding Exits 221