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

Portfolio dump system



PureBytes Links

Trading Reference Links

Hi Guys,

I have slightly modified the ELA code in the "portfolio dump" system:
http://www.markbrown.com/free/=RE%20Port%201.0.htm

Now there's no more need to cut-and-paste the code in your ELA signals: it's
a function.

          °¨¨°şİ[ Funes ]İş°¨¨°
"In God we trust, all others bring data"
---------------------------------------

* NAME:

Portfoliodump


* INPUTS:

- OutPath(String)
The path where the file will be placed (e.g. "c:\portfolio\");

- OutName(String)
The file name (e.g. "dailypl.por");

- Auto(NumericSimple)
Auto Mode:
0       no Auto Mode: use OutPath and OutName;
1       automatically create a file name (e.g. "OddBall_1011231.csv")


* OUTPUT:

The function return the file name, path included.


* EXAMPLE:

{**************************************************}
Inputs: Length(7),
  BuyZone(3),
  SellZone(1);

Var: OutputFile("");

if time > 830 and time <= 1500
then begin
 value1 = RateOfChange(Close Data2, Length);
 if value1 > BuyZone then Buy;
 if value1 < SellZone then Sell;
end;

OutPutFile = PortfolioDump("c:\", "dailypl.por", 0);
{**************************************************}


* ELA CODE:

{**************************************************
Description:   Portfolio dump system

Developed by: Rich Estrem (estrem@xxxxxxxxxxxxx)
Revised by:  Funes (funes@xxxxxxxxx)
***************************************************}

Inputs: OutPath(String), OutName(String), Auto(NumericSimple);

vars:  Symbol(""),
  MyStr(""),
  FileName(""),
  Net(0);

if CurrentBar = 1 then begin
 Symbol = GetSymbolName;
 if Auto = 0 then FileName = OutName
 else begin
  FileName = GetStrategyName +     { add the strategy name in the file
     }
     "_" + NumToStr(CurrentDate, 0) + { add the current date in the file
name      }
     ".csv";        { or ".por", like in the original "portfolio dump"
system }
 end;
end;

value11 = MarketPosition(0);
value12 = OpenPositionProfit + NetProfit;

if DataCompression = 2 then begin {begin daily data routine}
 value13 = value12 - value12[1];
 MyStr = Symbol + "," +
   NumToStr(Date, 0) + "," +
   NumToStr(value11, 0) + "," +
   NumToStr(value13, 2);
 FileAppend(OutPath + FileName, MyStr + NewLine);
end
else begin         {begin intraday data routines}
 if Date <> Date[1] then begin
  value13 = value12[1] - Net;
  MyStr = Symbol + "," +
    NumToStr(Date[1], 0) + "," +
    NumToStr(value11[1], 0) + "," +
    NumToStr(value13, 2);
  FileAppend(OutPath + FileName, MyStr + NewLine);
  Net = value12[1];
 end;
 if LastBarOnChart then begin
  value13 = value12 - Net;
  MyStr = Symbol + "," +
    NumToStr(Date, 0) + "," +
    NumToStr(value11, 0) + "," +
    NumToStr(value13, 2);
  FileAppend(OutPath + FileName, MyStr + NewLine);
 end;
end;

if LastBarOnChart then PortfolioDump = OutPath + FileName;

{********************* END ************************}