Giter Site home page Giter Site logo

Comments (8)

anandanand84 avatar anandanand84 commented on July 3, 2024

Hmmm, Do not use candlestick patterns yet, it is not complete, I'll add example in runkit once it is done, This is very basic there will be a lot of changes when we add more candlestick so the api may break.

from technicalindicators.

anandanand84 avatar anandanand84 commented on July 3, 2024

I think you are using the old version, has pattern should work in latest version, all tests are passing. It should fail only in getAllPatternIndex.

from technicalindicators.

chiu0602 avatar chiu0602 commented on July 3, 2024

I don't sure whether old version is used, but variable strategy cannot be found.

Even the pattern check haven't been fully implemented, I really can't wait for this interesting feature. Please let me put some comments here:
If array cannot fulfill requiredCount, exception should not be thrown. It is because logically it should be grouped into "pattern not found".
It is no doubt that your approach is right, just because I have written code as follow as a trial run::

var input = {
  date: [..., ..., ..., ...],
  open: [..., ..., ..., ...],
  close: [..., ..., ..., ...],
  high: [..., ..., ..., ...],
  low: [..., ..., ..., ...]
}
for(i =0 ... length) {
  let candlePattern;
  if(TI.AbandonedBaby.hasPattern(input)) candlePattern = ", AbandonedBaby";
  else if(TI.BearishEngulfingPattern.hasPattern(input)) candlePattern = ", BearishEngulfingPattern";
  else if(TI.BullishEngulfingPattern.hasPattern(input)) candlePattern = ", BullishEngulfingPattern";
  else if(TI.DarkCloudCover.hasPattern(input)) candlePattern = ", DarkCloudCover";
  else if(TI.Doji.hasPattern(input)) candlePattern = ", Doji";
  else if(TI.DownsideTasukiGap.hasPattern(input)) candlePattern = ", DownsideTasukiGap";
  else if(TI.DragonFlyDoji.hasPattern(input)) candlePattern = ", DragonFlyDoji";
  ...
  //output when pattern is found
  ...
  input.date.shift();
  input.open.shift();
  input.close.shift();
  input.high.shift();
  input.low.shift();
}

As candle patterns have no fixed requiredCount, it seems that the simple way to achieve what I want is to catch the exceptions.

Anyway, that is just my thought. Thanks for your great code.

from technicalindicators.

anandanand84 avatar anandanand84 commented on July 3, 2024

This is fixed on 0.2.9.

sample

from technicalindicators.

chiu0602 avatar chiu0602 commented on July 3, 2024

Sorry may I know where is strategy defined? I saw it be used in CandlestickFinder.js but I am not able to find where it is declared. Thanks

from technicalindicators.

anandanand84 avatar anandanand84 commented on July 3, 2024

CandlestickFinder is the parent class for all candlestick patterns, every candlestick pattern has a method logic, which is the strategyFn that is used. You can see this

https://github.com/anandanand84/technicalindicators/blob/master/lib/candlestick/CandlestickFinder.js#L32

and

https://github.com/anandanand84/technicalindicators/blob/master/lib/candlestick/BearishEngulfingPattern.js#L8

from technicalindicators.

chiu0602 avatar chiu0602 commented on July 3, 2024

Please try to change the input as follows in the sample to:

var twoDayBearishInput = {
  open: [21.44],
  high: [25.10],
  close: [23.25],
  low: [20.82]
}

Then you will get what I mean.
Thanks!

from technicalindicators.

anandanand84 avatar anandanand84 commented on July 3, 2024

Good catch!! It was due to dangerous copy paste. I have fixed it and added a test for it. Thanks. It should be available in version 0.2.10

from technicalindicators.

Related Issues (20)

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.