Skip to content

Incorrect use of MACD / SMA / EMA ... in Indicators? #114

Description

@sixcom

I am curious about the usage of results of something like trader_macd() / trader_sma() ?

  1. $this->getRecentData() gets the data in descending order e.g.
    <?php return [ '2018-01-03' => 5, '2018-01-02' => 15, '2018-01-01' => 20, ];

  2. trader_sma($recnetData, 2) will get
    <?php return [ 10, 20]

  3. In the code, pretty much everywhere uses array_pop() which returns the last element of array (in this case 20 is returned, but actually 10 is the latest SMA)

Is this correct? The default data size is 168, if the interval is one day then SMA result is average of some price data 100+ days ago, should it use the first element from the result array?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions