Skip to content

How xD #13

Description

@eventpunt

Am I missing something? Not getting any results.

require_once DIR.'/vendor/autoload.php';

// use LupeCode\phpTraderNative\Trader;
// $var = new Trader();
// ^ ?????

$closes = array(112.82, 117.32, 113.49, 112, 115.355, 115.54, 112.13, 110.34, 106.84, 110.08, 111.81, 107.12, 108.22, 112.28);
$time_period = 5;
$upper_deviation_multiplier = 2.0;
$lower_deviation_multiplier = 2.0;

$ma_type = TRADER_MA_TYPE_SMA; // Simple Moving Average
//TRADER_MA_TYPE_EMA - Exponential Moving Average
//TRADER_MA_TYPE_WMA - Weighted Moving Average
//TRADER_MA_TYPE_DEMA - Double Exponential Moving Average
//TRADER_MA_TYPE_TEMA - Triple Exponential Moving Average
//TRADER_MA_TYPE_TRIMA - Triangular Moving Average
//TRADER_MA_TYPE_KAMA - Kaufman's Adaptive Moving Average
//TRADER_MA_TYPE_MAMA - MESA Adaptive Moving Average
//TRADER_MA_TYPE_T3) - T3 Moving Average

var_dump(Trader::bbands($closes, $time_period, $upper_deviation_multiplier, $lower_deviation_multiplier, $ma_type));

Activity

  1. jb-lopez commented on Oct 11, 2022

    @jb-lopez
    Contributor

    You won't instantiate the Trader class. Remove this line

    $var = new Trader();

    And do you have the TRADER_MA_TYPE_SMA constant set to something? Do you have the trader extension installed? If the answer to both of those is no then you need to use

    $ma_type = \LupeCode\phpTraderNative\TALib\Enum\MovingAverageType::SMA;
  2. locked and limited conversation to collaborators on Oct 11, 2022
  3. converted this issue into a discussion #14 on Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions