After some fits and starts, I got myself all set to go with being able to write a simple example program in VIM, compile it with gcc, run it from command line (there is a ./ trick that took a while to figure out) and then commit it to a repository that I previously set up in my Dropbox account. Now it was a matter of going through Kochan's book and compiling all his example code. I've almost finished the book and probably will finish it within a week. After getting through pointers, it's basically knowledge acquisition and not conceptual grasping any more.
I will use C to turbo-charge some R functions that I have planned. And I will use C as a building block to learning C#, which I plan on using quit a bit in deploying neural network solutions to market prediction.
It may not seem like much, this first program of mine. But actually, I'm quite pleased. It actually works. Here is what we want to do. Enter price data from the terminal and have the program return the Open, High, Low and Close in that order. Sort of like an echo. It's a 'knock, knock, anybody there?' sort of program. But the potential is there for more functional things to come.
// Here we will randomly enter the OHLC data manually from the terminal
// And essentially spit it out in a new order, that being OHLC
#include <stdio.h>
int main (void) {
float O,H,L,C;
printf("Enter the High of the Day: \n");
scanf("%f", &H);
printf("Enter the Low of the Day: \n");
scanf("%f", &L);
printf("Enter the Open of the Day: \n");
scanf("%f", &O);
printf("Enter the Close of the Day: \n");
scanf("%f", &C);
printf("The OHLC data is: %.2f, %.2f, %.2f, %.2f \n", O,H,L,C);
return 0;
}
Feel free to copy this code and compile it yourself. Admittedly it's not very exciting. It did take me a while to get here though, and the fun is just starting. Markets, beware.
6 comments: