Hello eSignal EFS community,
This indicator supposed to read transactions in a text file and plot these in the chart in any timeframe. The text file, located in FormulaOutput, contains the following information (in this case for EUR/AUD):
(Transaction No;Date/Time;Buy/Sell;Lot;Price)
Unfortunately, I do not succeed to plot any data. I am able to load the indicator, and there is no syntax error. Any hint, where I should look for the error?
Daniel
This indicator supposed to read transactions in a text file and plot these in the chart in any timeframe. The text file, located in FormulaOutput, contains the following information (in this case for EUR/AUD):
PHP Code:
009;01.03.2012 13:38;S;200000;1.23441
009;02.03.2012 10:17;B;100000;1.22992
009;05.03.2012 08:26;B;100000;1.23388
011;06.03.2012 03:34;B;200000;1.24204
011;08.03.2012 15:44;S;100000;1.25014
011;09.03.2012 13:30;S;100000;1.24028
029;03.04.2012 09:35;B;300000;1.2873
029;04.04.2012 12:05;S;300000;1.27829
Unfortunately, I do not succeed to plot any data. I am able to load the indicator, and there is no syntax error. Any hint, where I should look for the error?
PHP Code:
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description
//{{EFSWizard_Declarations
var vLastAlert = -1;
var lines = new Array();
var index = 0;
var t = 0;
var type = "";
var lot = 0;
var p = 0;
var firstrun = true;
var count = 0;
//}}EFSWizard_Declarations
function preMain()
{
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(true);
setStudyTitle("Transaction Visualizer");
setShowCursorLabel(false);
setShowTitleParameters(false);
//}}EFSWizard_PreMain
var f1 = new FunctionParameter("Path", FunctionParameter.STRING);
with(f1)
{
setName("File Path");
setDefault("");
}
}
function main(Path)
{
if(firstrun)
{
var f = new File("aud.txt");
if(f.exists())
{
f.open("rt");
var line;
while(!f.eof())
{
line = f.readln();
if(line == null) break;
count = lines.push(line);
debugPrintln(count);
}
f.close();
}
else
{
debugPrintln( Path );
}
index = 0;
firstrun = false;
}
if(getBarState() == BARSTATE_NEWBAR)
{
while(index < count)
{
ParseLine();
debugPrintln(t + " = " + rawtime(-1));
if(t >= rawtime(-1) && t < rawtime(0))
{
if(type == "B")
{
drawShapeRelative(-1, p, Shape.UPARROW, null, Color.blue, Shape.ONTOP);
}
else
{
drawShapeRelative(-1, p, Shape.DOWNARROW, null, Color.red, Shape.ONTOP);
}
index++;
}
else
{
break;
}
}
}
//{{EFSWizard_Return
return null;
//}}EFSWizard_Return
}
function ParseLine()
{
var a = lines[index].split(";");
t = Date.parse(a[1])/1000;
//debugPrintln(a[1] + " - " + t);
type = a[2];
lot = a[3];
p = a[4];
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
vLastAlert = 1;
}
//}}EFSWizard_Action_1
//}}EFSWizard_Actions
Daniel
Comment