Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP trader extension candle recognition errors

Tags:

arrays

php

I don't know if anyone has run into this or have had a similar problem with the PHP trader extension:

http://php.net/manual/en/book.trader.php

Any help would be really appreciated, here's what I have done:

  1. "Installed" the DLL and updated my php.ini to load the extension.
  2. I have a php page with "print_r(get_extension_funcs("trader"));" and produced an array with all the trader functions, so I assume it is installed ok.
  3. I have run various moving average/adx/cci etc functions and I get an array of results.

BUT whenever I try to run ANY of the candle recognition functions I get a response of "False", which looking at the link below means the function has not run correctly. I'm expecting an Array of 6 results not a Boolean of "False".

http://php.net/manual/en/function.trader-cdldoji.php

$open = [112.818, 112.226, 111.725, 112.144, 112.463, 112.205]; 
$high = [113.21,113.257,112.476,112.53,112.554,112.716];  
$low = [112.253,112.219,111.497,111.474,111.653,112.134];
$close = [112.339,112.804,112.234,111.716,111.993,112.483];
$test1 = trader_cdldoji($open, $high, $low, $close);
var_dump($test1);

I'm really struggling with this as the code above is so simple I can't believe it doesn't work, I have also tried the following:

$open = [112.818, 112.226, 111.725, 112.144, 112.463, 112.205]; 
$high = [113.21,113.257,112.476,112.53,112.554,112.716];  
$low = [112.253,112.219,111.497,111.474,111.653,112.134];
$close = [112.339,112.804,112.234,111.716,111.993,112.483];
$test1 = array(trader_cdldoji($open, $high, $low, $close));
var_dump($test1);

I'm really hoping I've done something really stupid that I just can't see after a couple of hours of hair pulling! Any help much appreciated, thanks everyone,

George

like image 318
George Avatar asked Sep 29 '17 19:09

George


1 Answers

I have no idea what that function does (the documentation for the trader extension is hopelessly lacking), but it appears that 6 values is not enough. I ran some tests and only got it to give me an actual result if the arrays contain 11 or more values.

like image 99
rickdenhaan Avatar answered Oct 22 '22 10:10

rickdenhaan