Giter Site home page Giter Site logo

atr's Introduction

Average True Range

Calculate the ATR of giving values.

Atr

Instalation

composer require romulodl/atr

or add romulodl/atr to your composer.json. Please check the latest version in releases.

Usage

$atr = new Romulodl\Atr();
$atr->calculate(array $hlc_values, int $period = 14);
//returns a float value

$hlc_values is an array of arrays containing 3 prices: [High, Low, Close]

Example of use:

$atr = new Romulodl\Atr();
$atr->calculate([
  [9950.00,9250.66,9786.80],
  [9843.50,9100.00,9310.73],
  [9585.00,9210.03,9374.99],
  [9880.00,9317.16,9678.57],
  [9958.67,9450.00,9731.10],
  [9900.00,9462.00,9773.64],
  [9838.00,9281.42,9508.11],
  [9573.00,8812.20,9060.00],
  [9259.38,8920.00,9166.40],
  [9300.00,9076.90,9176.41],
  [9294.44,8674.00,8711.37],
  [8977.00,8623.38,8895.65],
  [9011.82,8693.18,8837.05],
  [9230.00,8811.00,9197.32],
]);

Why did you do this?

The PECL Trading extension is crap and not everyone wants to install it. I am building a trading bot which will need the ATR value as part of the calculation.

atr's People

Contributors

romulodl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.