Thank you for your interest and suggestions Paul.
Perhaps I should explain in further detail what I have done and what I
am trying to do.
I have tried Data::Dumper to display the contents of both @dmiData and
@dmiDataSlice as the loop runs.
Before dying feeding @dmiData to Data::Dumper returns:
<code>
$VAR1 = [
[
168,
166,
167
],
[
168,
166,
168
],
[
168,
166,
168
],
[
168,
166,
168
]
</code>
The main loop intentionally reads live market data approximately twice
a second, so understandably data may be unchanged from the previous
iteration.
As a further example my current script also uses your excellent
Math::Business::BollingerBands.
I use this in the following way.
I initialise this module using:
<code>
my $bb = Math::Business::BollingerBands->recommended;
</code>
I feed this an array of the last 22 closing prices constructed by
pushing the latest price onto the array, and if the array is greater
than 22 items, shifting the oldest price off the array.
(the value of 22 was determined through repeated running of cached
data to provide the most profitable graph for my trigger parameters -
so many variables!)
This 22 item array is then passed to the BollingerBands object:
<code>
$bb->insert( @lastPriceMatched )
</code>
Now from reading your reply I wonder if I'm making it hard for myself
(and your modules) by throwing them an array of 22 prices, which all
but 1 will have been passed previously, albeit shifted by 1 place.
To summarise, I have serial live market data @ 2Hz approx. and I want
to get the most accurate calculation possible in 1/10 second. Should I
just pass the latest value or the last 20 values to get an accurate
calculation? Does this also vary from different maths modules?
Once again thank you for your patience and help.
Kind Regards,
Bob