Variables:
{2} MoneyExport(True);
If MoneyExport = True Then Begin
Variables: MP(0), TT(0), FileName(""), TradeString(""), OldString(""),
FirstExpDate(0), Missing(0), FillDate(0), SteppinIn(0), PosProfit(0),
ClosedProfit(0), StopLoss(0), RiskValue(0), ExcelMonth(0), ExcelDay(0),
ExcelYear(0), ExcelDate("");
{3} If BarNumber = 1 Then Begin
FileName = "D:\Temp\Optisize-" +
RightStr(NumToStr(CurrentDate, 0), 4) + "-" +
LeftStr(GetSymbolName, 4) + ".csv";
FileDelete(FileName);
TradeString = "Date" + "," + LeftStr(GetSymbolName, 8) + "," +
"Risk ($)" + "," + "Open ($)" + "," + "Close ($)" + NewLine;
FileAppend(FileName, TradeString);
FirstExpDate = DateToJulian(LastCalcDate) - 2500 * 1.4;
If DateToJulian(Date) >= FirstExpDate Then Begin
For Missing = FirstExpDate To (DateToJulian(Date) - 1) Begin
FillDate = JulianToDate(Missing);
If DayOfWeek(FillDate) > 0 and
DayOfWeek(FillDate) < 6 Then Begin
{4} ExcelMonth = Month(FillDate);
ExcelDay = DayOfMonth(FillDate);
ExcelYear = Year(FillDate);
If ExcelYear >= 100 Then
ExcelYear = 2000 + (ExcelYear - 100);
ExcelDate = NumToStr(ExcelMonth, 0) + "/" +
NumToStr(ExcelDay, 0) + "/" + NumToStr(ExcelYear, 0);
TradeString = ExcelDate + "," + "0" + "," +
"0" + "," + "0" + "," + "0" + NewLine;
If TradeString <> OldString Then
FileAppend(FileName, TradeString);
OldString = TradeString;
End;
End;
End;
End;
CHAPTER 27 Spreadsheet Development 339