Original Post
Hi, I'm fairly new to programming and I'm trying to create a stock trading simulator using minute-by-minute price data from a text file. Here is an example of the text file output: FNM. [180 bars] Time, Date, Open, High, Low, Close, Volume 13:01:00, 09/26/2008, 1.740000, 1.770000, 1.740000, 1.770000, 942722 During that minute, the price opened at 1.74, went as high as 1.77, went as low as 1.74, and closed at 1.77 at the 60th second. All during each second, the price ticks up and down and arrives at a specific price per second. The problem I'm having is trying to simulate the price action during that time period given the following parameters: 1. The price hits the high and low at random points during the timeline of 60 seconds. 2. The price never exceeds the high or the low during that 60 second period. 3. The price ticks up and down between $-.03 and $.03, but ultimately I'd like it to be customizable. 4. There can be more than 1 price tick up or down per second. So I'd setup variables that represent those prices: var_open, var_high, var_low, var_close. I'd setup array second[60] to represent the timeline. second[0] would be var_open, second[59] would be var_close. Then I would randomly choose second locations for var_low and var_high that were at least 2-3 elements from second[0] and second[59]. The next part is where I'm stuck. I really lack the expertise to create an algorithm that creates valid prices between those points given the parameters outlined above. Of course it's very easy to do it all linearly, but that's not emulating real stock price action. Can anyone help? Thanks!