PosProfit = EntryPrice - Close;
End;
MP = MarketPosition;
TT = TotalTrades;
If TT > TT[1] and MP <> MP[1] Then Begin
If MP[1] = 1 Then
ClosedProfit = ExitPrice(1) - EntryPrice(1);
If MP[1] = -1 Then
ClosedProfit = EntryPrice(1) - ExitPrice(1);
End;
If SteppinIn <> SteppinIn[1] and SteppinIn > 0 Then
RiskValue = RiskCalc;
{7} ExcelMonth = Month(Date);
ExcelDay = DayOfMonth(Date);
ExcelYear = Year(Date);
If ExcelYear >= 100 Then
ExcelYear = 2000 + (ExcelYear - 100);
ExcelDate = NumToStr(ExcelMonth, 0) + "/" + NumToStr(ExcelDay, 0) +
"/" + NumToStr(ExcelYear, 0);
TradeString = ExcelDate + "," + NumToStr(SteppinIn, 4) + "," +
NumToStr(RiskValue, 4) + "," + NumToStr(PosProfit, 4) + "," +
NumToStr(ClosedProfit, 4) + NewLine;
If TradeString <> OldString Then
FileAppend(FileName, TradeString);
OldString = TradeString;
End;
End;
Comments on the Code
Because we already have stepped through a few pieces of code, I will keep the
comments brief.
- The RiskCalc variable must be added to the system code (preferably adjacent
to the stops and exits) to calculate the MMP. - The variable MoneyExport(True) must be placed on top of the code or even
as an input. The other variables will only become active when MoneyExport
is set to True. To speed up the computing time, the program will not run
through the rest of the code as long as MoneyExport is set to False.
CHAPTER 27 Spreadsheet Development 341