Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Math::Business::DMI
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
BobBack  
View profile  
 More options Sep 14 2010, 1:52 pm
From: BobBack <drchap...@gmail.com>
Date: Tue, 14 Sep 2010 10:52:07 -0700 (PDT)
Local: Tues, Sep 14 2010 1:52 pm
Subject: Re: Math::Business::DMI
Thank you Paul for your very prompt reply.

> Works for me... I need to see more of your code.

And the example you posted evaluates for me also. I think that clearly
exonerates your module from any blame. My code is another matter.
For curiosity I'll post a snippet of my code. As the whole script is
around 47kB this is just a snip, and it's entirely possible the error
is elsewhere.

<code>
#!/usr/bin/perl -w

use Math::Business::DMI;

#declarations
my $dmi = Math::Business::DMI->recommended;
my (
        @dmiData,
        @dmiDataSlice,
        $adx,
        $pdi,
        $mdi,
);

#part of main loop
@dmiDataSlice = (
        priceToTick($data->{$selectionId}->{'B1'}->{'price'}),
        priceToTick($data->{$selectionId}->{'L1'}->{'price'}),
        priceToTick($data->{$selectionId}->{'runner'}-

>{'lastPriceMatched'}),

 );

        push (@dmiData, [@dmiDataSlice]);
        if ( scalar (@dmiData) >5) {
                shift @dmiData;
        }

        print "@dmiDataSlice\n"; # debug to check the input data

        $dmi->insert( @dmiData );
        ($pdi, $mdi, $adx) = $dmi->query;

#loop
</code>
The whole script features a loop which reads prices twice a second and
places trades depending on position. I intended to add in the DMI
module to indicate a strong position, either buy or sell.
The priceToTick function returns an integer

This snippet is supposed to push new data onto the @dmiData array and
shift old data off it.
I have managed to get it to run without dying by changing the '5' to
'4' in the following line:

        if ( scalar (@dmiData) >5) {

but as to why I'm currently none the wiser! I suspect it's probably
inexperience with Perl in general, and referencing/dereferencing
arrays in particular.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.