[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is this function loop possible?



PureBytes Links

Trading Reference Links

I am trying to create a function loop to export all Long trades to an ASCII
file.

Something is amiss as it seems to loop through the last 10 trades only.

Is this the normal, ie not possible to extract the info at the
LastBarOnChart?

Or should I write-out the trade as it is being triggered?

TIA & Season's greetings
KLow

***************************************************************************
Var: Count(1);

If LastBarOnChart then begin
.
. { other codes }
.
if TotalTrades > 0 then begin
  for TradeNum = TotalTrades DownTo 1 begin
    FileAppend(AscFile,
    "Trade # " + NumToStr(Count, 0) + "  " +
    NumToStr(EntryDate(TradeNum),  0)  + "  " +
    NumToStr(EntryPrice(TradeNum), 3)  + "  " +
    NumToStr(ExitDate(TradeNum),   0)  + "  " +
    NumToStr(ExitPrice(TradeNum),  3) + NewLine );
   Count = Count + 1;
  end;
 end;
end;

Resulting ASCII file
--------------------------
Trade # 1  1010809  31.125  1010822  31.000
Trade # 2  1010926  26.125  1011009  27.125
Trade # 3  1011024  28.500  1011114  30.500
Trade # 4  0  0.000  0  0.000
Trade # 5  1001222  31.375  1010108  31.018
Trade # 6  1010125  31.125  1010205  31.625
Trade # 7  1010227  30.563  1010308  30.875
Trade # 8  1010403  29.250  1010409  28.625
Trade # 9  1010510  29.500  1010606  31.125
Trade # 10  1010608  31.875  1010618  32.125
Trade # 11  1010719  32.000  1010724  31.250
Trade # 12  1010809  31.125  1010822  31.000
Trade # 13  1010926  26.125  1011009  27.125
Trade # 14  1011024  28.500  1011114  30.500
****************************************************************************