Hi All, All of my programming was done in Visual Studio Express 2008 version. Thinking of upgrading to 2015 now that I have a Win 10 machine and given that I want to start learning some of the new functionality re C++ 11 and 14. Any tips/thoughts on how to migrate my files? I've tried this once before on a Win 7 PC and remember having some issues getting the programs to work. Thanks, TR

Member Avatar
Member Avatar
+0 forum 1

Hello, My function below is part of a program that compiles and runs. The core of the program is in the function below. The issue is that the variable named "PNL" below as well as "CumLoss" and "CumProfit" don't reset to 0 when the loop "L" restarts. So the output in the output file ends up being a cumulative PNL and cumulative CumLoss and CumProfit instead of the PNL for each individual run of Loop "L". So the output looks like this: 262.75 60.7542 0.832699 1.28905 735.5 61.9823 0.875953 1.42811 1074.5 62.2238 0.857014 1.41165 Focus on the first column above …

Member Avatar
Member Avatar
+0 forum 1

Hi, I'm trying to compute a moving average of length 20. I've got a vector of structs that's read into my function and I'm using an iterator to read through as follows: int length = a; int count = 0; double sum = 0; while (itr!= priceinput.end()) { sum += itr->Close; count ++; if (count >= length) { itr->MovingAve = (sum / (double) length); sum -= (itr-length)->Close; // this is the problem line } So I'm trying to find out what the right syntax is for the sum-= line. When count gets to 21, I have to subtract the 1st …

Member Avatar
Member Avatar
+0 forum 1

Hi, I'm wondering what could cause this type of runtime error: My program basically reads data from different kinds of data files, either a minute data file or a 5 minute data file and then does some analysis. When I run the program on the 1 min data, no problem. BUt when I run it on the 5 min data, I get a runtime error message/assertion failure that says: Line 163 ** Expression: ("_Myptr + _Off <= ((Myvec* this->_Getmycont()))->_Mylast &&_Myptr + _Off>= etc** Line 163 simply states: 163 std::vector<SwingIdentified>::iterator SwingIter; 164 for (SwingIter= NamedSwings.begin(); SwingIter!=NamedSwings.end(); SwingIter++) 165 { 166 outfile …

Member Avatar
Member Avatar
+0 forum 22

Hi, I'm new to APIs. Got the code below to compile (with 3 warnings C4129) but it won't output to the designated path. I created the txt file ahead of time, nqquotes.txt, but after the code compiles, that file stays empty. Thanks for your help, TR #include "stdafx.h" #include <tchar.h> #include <urlmon.h> #include <iostream> using namespace std; #pragma comment(lib, "urlmon.lib") int main() { cout << "downloading NQ data from Quandl..."; HRESULT hr = URLDownloadToFile ( NULL, _T("https://www.quandl.com/api/v1/datasets/CME/NQH2015.csv"),_T("C:\users\my documents\visual studio 2008\projects\nq data\nqquotes.txt"), 0, NULL); cout << "Done!" << endl; system("PAUSE"); }

Member Avatar
Member Avatar
+0 forum 4

Hi All, Well I've been stuck for a while here. I'm trying tp write a function called TransfertoSwingID which will transfer a line of data held in a struct contained in a vector to a new vector of structs. Basically as I'm iterating through the vector of structs called "prices", if the conditions are true, then I need to transfer/copy the data held in the struct that is being pointed to by *(it-1). There are 2 sets of conditions, if the 1st set is true, then I pass an integer, 0, to the function so that the data transferred would …

Member Avatar
Member Avatar
+0 forum 1

Hi, I've got a vector of structs populated with the following fields: double double double double (unsigned int) (unsigned int) string I want to take each line in that vector (call it OldVec), and 1. transfer it to a new vector of structures 2. add a string identifier at the end of said line. So I can create a new vector of structures with the above 7 variables and add a string to it. Let's call that NewVec and it would contain: double double double double (unsigned int) (unsigned int) string string. How can I do the copy from OldVec …

Member Avatar
Member Avatar
+0 forum 10

Hi, Imagine a vector of structures with each structure containing various variables. struct Data { double x double y double z } vector<Data> Dataset vector<Data>::iterator it //input some data from a file into DataSet How can I iterate over this vector, comparing say, x at the nth row to the x at the (n-1th) row and the x at the (n-2th) row, beginning at n (where n is Dataset.begin() + 2) and moving one n forward at a time? Thanks, TR

Member Avatar
Member Avatar
+0 forum 8

Hi, I've got stock market data in a structure as follows. [CODE]struct PriceInfo { double Open; double High; double Low; double Close; unsigned int Volume; unsigned int Time; std::string Date; };[/CODE] My program imports the data from a csv file and stores it in memory etc. The date and time look like this when printed to screen. Date Time Open High Low Close Volume 12/10/2009 930 2100 2200 2075 2150 10000 12/10/2009 931 ....etc 12/10/2009 932 ....erc I now need to be able to compare data using the date (string) and time (unsigned int) as 'sort by' fields. Essentially, I'd …

Member Avatar
Member Avatar
+0 forum 6

Hi everyone, When I try the code below with data in a txt file, I have no problems and the data prints properly and neatly on the screen. (Note, one slight modification when using a txt file, instead of getline (ist, ignored, ','), I do getline (ist, ignored, '/t') to ignore tabs since the txt file is tab delimited ) But when I try the code below on a csv file, it ends up printing a jumbled mess and keeps on in a never ending loop, even though the data is limited to a few days worth of data. I …

Member Avatar
Member Avatar
+0 forum 9

I have some stock market price data organized as follows in a structure: struct PriceInfo { string Date; unsigned int Time; double Open; double High; double Low; double Close; unsigned int Volume; }; This struct organizes price data per interval of date and interval of time, where time is measured in minutes. So for instance, minute data would look like this: 121009 930 2100 2200 2075 2150 10000 121009 931 .... 121009 932 Where 930 is 9:30 am and 121009 Dec 10th 2009. A whole day's worth of data, measured in 1min intervals, runs from 930 to 1614 pm. The …

Member Avatar
Member Avatar
+0 forum 22

Hi, I have a csv datafile with stock price data that I've read into a vector of structures that looks like this: 09/11/2009 9.30 open, high, low, close, volume 09/11/2009 9.31 o, h, l, c, volume and so on to 09/11/2009 16.14 o, h, l, c, volume //next day starts here: 09/12/2009 9.30, o, h, l, c, volume 09/12/2009 9.31, o, h, l, c, volume As you can see, each date has ~390 minutes of price data associated with it. I would like to be able to compare these dates, but the date field is of type string. How do …

Member Avatar
Member Avatar
+0 forum 4

I'm reading a big csv file into a data structure defined as such: [CODE]struct PriceInfo { double Open; double High; double Low; double Close; unsigned int Volume; unsigned int Time; std::string Date; };[/CODE] So somewhere in my main function, I have this line: // read contents of datafile by overloading the input operator into a vector of type <PriceInfo> called prices [CODE]while (! dataFile.eof()) { dataFile >> prices }[/CODE] The csv file is comma delineated, so I use an extra function to do the parsing, beyond a template and the overloading function (with the following header std::istream& operator>>(std::istream& istream, PriceInfo& …

Member Avatar
Member Avatar
+0 forum 11

Hi, The following code I've been working on (as hobbyist) compiles okay, buy at runtime it fails to output the dates that it is supposed to extract from a csv file. I've been staring at this forever and no progress. I am thinking that the problem occurs before the date verification function, because when the program gets to cout << "This is the first date in the database" and cout << dataArray[0].date << endl, it does not output the date. This means that the first element in the array is empty, which means that the array did not populate for …

Member Avatar
Member Avatar
+0 forum 5

The End.