What is the meaning of the values returned from trader_bbands()?

◇◆丶佛笑我妖孽 提交于 2019-12-07 07:58:59

问题


I am using the trader library of PHP.

I use the trader_bbands() function

$bBand = trader_bbands( $NumberArray,
                        25,
                        TRADER_REAL_MIN,
                        TRADER_REAL_MIN,
                        TRADER_MA_TYPE_EMA
                        );

It returns three arrays.

$bBand[0]; // upper-edge of the Bollinger Band           ( an upline )
$bBand[1]; //  central line the Bollinger Bands surround ( a moving average )
$bBand[2]; // lower-edge of the Bollinger Band           ( a downline )

My original $NumberArray values are all around 2000.0

$bBand[1] is simple moving average so, it returns the numbers around 2000.

However $bBand[0] and $bBand[2] return values like this below (example cited from var_dump() )

  double(3.1325286910105E+38)
  [105] =>
  double(3.1907365920756E+38)
  [106] =>
  double(3.1907365920756E+38)
  [107] =>
  double(3.1740850650235E+38)
  [108] =>
  double(3.1498571396175E+38)

Q1: What does this array mean?

What I expect from Bollinger Band is array around 2000 + α, or 2000 - α though.


回答1:


A1:
1. Review the php-library documentation on trader_bbands(), as a first step.
2. Publish MCVE-altogether-with-a-DataSET to allow validation against a common DataSET
3. Compare reference implementations to prove { PASS | FAIL }-status of Trader php-library implementation.

Ad Step 1.:
array trader_bbands ( array $real [, integer $timePeriod [, float $nbDevUp [, float $nbDevDn [, integer $mAType ]]]] )

Let's agree to set $nbDevUp = 1.0, not a technically smallest float TRADER_REAL_MIN
Let's agree to set $nbDevDn = 1.0.

Let's agree to set $timePeriod = 7

Let's agree to set $real

$real = array(
               0 => 2000.0,
               1 => 2001.0,
               2 => 2002.0,
               3 => 2003.0,
               4 => 2004.0,
               5 => 2005.0,
               6 => 2006.0,
               );

Expectations:

The .std()-sigma-related values ought get into a fair fashion, independently of not knowing all implementation details about the Trader php-library model of trader_bbands() calculus, particularly in the TRADER_MA_TYPE_EMA mode, missing the exponential-weighting details used inside their model. Nevertheless

A) There ought be sure all differences
between $bBand[0][i] - $bBand[1][i] == $bBand[1][i] - $bBand[2][i] to be == 2.0

B) There ought be a value of what value of the exponent was used in .ewma()-method documented somewhere in Trader php-library.

Well, sure, without such value, one may resort to a brute-force reverse search for a matching value used, but it may be a rather inefficient method to prove the $bBand[1] values are calculated in Trader php-library in a manner compatible to the common Quant-practice to use
ewmaEXP = 2.0 / ( timePeriod + 1 ).



来源:https://stackoverflow.com/questions/40866649/what-is-the-meaning-of-the-values-returned-from-trader-bbands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!