I have the following code and it takes like foreeeeever to evaulate:
Table[Table[{If[closeN[[x]] > Max@priceRange[[y]], 1,
If[closeN[[x]] < Min@priceRange[[y]], -1, 0]],
DateString /@ Extract[date, Position[closeN, closeN[[x]]]]}, {x, 1,
Length[closeN]}], {y, 1, Length[priceRange]}]
What it basically does is looking when a price is greater (assigns a 1), smaller (a -1) or in between (0) a priceRange. It also extracts the date of the prices from closeN.
I always do it in this way, but I realize it might not be an optimal and fast way.
Any ideas or assumptions how to optimize the evaluation time?
here is a small subset:
date={{2000, 2, 2, 0, 0, 0.}, {2000, 2, 3, 0, 0, 0.}, {2000, 2, 4, 0, 0,
0.}, {2000, 2, 7, 0, 0, 0.}, {2000, 2, 8, 0, 0, 0.}, {2000, 2, 9, 0,
0, 0.}, {2000, 2, 10, 0, 0, 0.}, {2000, 2, 11, 0, 0, 0.}, {2000, 2,
14, 0, 0, 0.}, {2000, 2, 15, 0, 0, 0.}}
closeN= {0.9766, 0.9899, 0.9838, 0.981, 0.9861, 0.9933, 0.9852, 0.9808,
0.9791, 0.9816}
priceRange={{0.8273}, {0.8301}, {0.8394, 0.8354, 0.8363, 0.8393, 0.8383,
0.8396}, {0.8437, 0.8425, 0.8401, 0.844, 0.84, 0.8449, 0.8444,
0.8445}, {0.8494, 0.8491, 0.8485, 0.845, 0.8483, 0.8463, 0.8468,
0.8499, 0.8478, 0.8474, 0.8466, 0.8483, 0.8489}, {0.8532, 0.8546,
0.8517, 0.8507, 0.8545, 0.8541, 0.851, 0.8527, 0.8549, 0.8517,
0.8511, 0.8534, 0.8541, 0.8541, 0.8528}, {0.8587, 0.857, 0.8585,
0.8557, 0.8579, 0.8567, 0.8579, 0.8561, 0.8575, 0.8558, 0.8573,
0.8561, 0.8555, 0.8554, 0.8557, 0.855, 0.8581, 0.8596, 0.8598,
0.8559, 0.8582, 0.855, 0.8596, 0.8593}, {0.8639, 0.8601, 0.8646,
0.861, 0.863, 0.8612, 0.8635, 0.8608, 0.8611, 0.8617, 0.8606,
0.8631, 0.8608, 0.8608, 0.8636, 0.8618, 0.8622, 0.8621,
0.8638}, {0.867, 0.8695, 0.8687, 0.8685, 0.8655, 0.8677, 0.8662,
0.8657, 0.8695, 0.8652, 0.865, 0.8698, 0.8672, 0.8668, 0.8694,
0.8691, 0.866, 0.8693, 0.8655, 0.8699}, {0.8717, 0.8725, 0.8747,
0.8721, 0.8729, 0.8747, 0.8736, 0.8722, 0.8719, 0.8732, 0.8747,
0.8703, 0.8729, 0.871, 0.8742, 0.8736, 0.8706, 0.8704, 0.8717,
0.8747, 0.8726, 0.8713, 0.8723, 0.8747}}
here is whole the data (just copy it into mathematica and evaluate, then it should work):
closeN: https://dl.dropboxusercontent.com/u/19921198/closeN.txt
date: https://dl.dropboxusercontent.com/u/19921198/date.txt
priceRange: https://dl.dropboxusercontent.com/u/19921198/priceRange.txt