For SCT.ArrayPosition = 0 To (NoTradesVar - 1) Begin
SCT.SumProfit = SCT.SumProfit +
SCT.TradeProfit[SCT.ArrayPosition];
If SCT.TradeProfit[SCT.ArrayPosition] > 0 Then
SCT.WinTrades = SCT.WinTrades + 1;
{7} End;
If NoTradesVar <> 0 Then Begin
AvgTradeVar = SCT.SumProfit / NoTradesVar;
PercWinVar = SCT.WinTrades * 100 / NoTradesVar;
End
Else Begin
AvgTradeVar = 0;
PercWinVar = 0;
End;
{8} For SCT.ArrayPosition = 0 To (NoTradesVar - 1) Begin
SCT.SumSqProfit = SCT.SumSqProfit +
Square(SCT.TradeProfit[SCT.ArrayPosition]);
{9} End;
If NoTradesVar <> 0 Then
StDevVar = SquareRoot((NoTradesVar *
SCT.SumSqProfit - Square(SCT.SumProfit)) / (NoTradesVar *
(NoTradesVar - 1)))
Else
StDevVar = 0;
{10} SCT.TestString = LeftStr(GetSymbolName, 5) + "," + SCT.TradeType
+ "," + NumToStr(TestRunVar, 0) + "," + NumToStr(StopLossVar, 2) + ","
+ NumToStr(ProfTargVar, 2) + "," + NumToStr(TrailStopVar, 2) + "," +
NumToStr(MaxBarsVar, 0) + "," + NumToStr(AvgTradeVar * 100, 2) +
"," + NumToStr(StDevVar * 100, 2) + "," + NumToStr(NoTradesVar, 0) +
"," + NumToStr(PercWinVar, 2) + "," + NewLine;
FileAppend(SCT.FileString, SCT.TestString);
End;
End;
{11} Code for stop type 1 (percentage stops).}
If StopTypeVar = 1 Then Begin
If BarNumber = 1 Then Begin
SCT.LongLoss = 1 - StopLossVar * 0.01;
222 PART 3 Stops, Filters, and Exits