Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 20:06:01 +0000



Post From: Is There A Faster Way to Enter Custom Study Data Inputs

[2017-11-27 15:39:56]
ertrader - Posts: 644
Below are other function calls I had to create to ensure I had control over when processing began and ended. I used text files and the values within them.

int ControlFile(SCStudyInterfaceRef sc)
{
  std::ifstream input("controlfile.txt");
  // set the global variable control line to indicate when to stop reading  
  input >> g_ControlLine;
  return(0);    
}
float WriteFile(SCStudyInterfaceRef sc)
{
  std::ofstream output;
  output.open ("writefile.txt", std::ofstream::out | std::ofstream::app);

  // insert into the file and add spaces between variables
  output << g_ControlLine << " " << g_ProfitFactor << " " << g_TotalPercentProfitable << " " << g_MaximumDrawdown << " " << g_MaximumTradeRunup <<" " << g_TotalTrades << " " << g_TotalLongTrades << " " << g_TotalShortTrades << "\n";
  output.close();
  return(0);    
}
int ProcessingFile(SCStudyInterfaceRef sc)
{
  std::ofstream output;
  output.open ("processing.txt", std::ofstream::out | std::ofstream::ate);

  // insert into the file and add spaces between variables
  output << g_Processing;
  output.close();
  return(0);  
}

int StartProcessing(SCStudyInterfaceRef sc)
{
  // enable or disable processing. 0 = disable, 1 = enable. Used to control when initially loading the study
  std::ifstream input("startprocessing.txt");
  input >> g_StartProcessing;
  return(0);  
}