Thanks a mil
try
{
if(dExp.WCCIPattern[0] != 0)
{
sw = File.AppendText(@FilePath);
// If file at 'path' doesn't exist it will create the file. If it does exist it will append the file.
if(dExp.WCCIDirection[0] == 1)
nextOpen = Close[0] + TickSize;
else
nextOpen = Close[0] - TickSize;
sw.Write("\r\n"+Time[0].ToString("M-dd-yyy")+","+Time[0].ToString("HH:mm")+","+Pattern+","+dExp.WCCIDirect ion+","+","+nextOpen);
sw.Flush();
sw.Close();
}
else
if(dExp.WCCIPattern[1] != 0)
{
sw = File.AppendText(@FilePath);
if(dExp.WCCIDirection[1] == 1)
{
sw.Write(","+(Open[0] - Low[0])/TickSize+","+(High[0]-Open[0])/TickSize);
sw.Flush();
sw.Close();
}
else
{
sw.Write(","+(High[0] - Open[0])/TickSize+","+(Open[0]-Low[0])/TickSize);
sw.Flush();
sw.Close();
}
}
}
catch (Exception e)
{
// Outputs the error to the log
Log("You cannot write and read from the same file at the same time. Please remove SampleStreamReader.", NinjaTrader.Cbi.LogLevel.Error);
throw;
}
Comment