Giter VIP home page Giter VIP logo

Comments (5)

TheCookieLab avatar TheCookieLab commented on May 19, 2024 1

Rule myJustOnceRule = new CrossedUpIndicatorRule(indicator1, indicator2).and(new JustOnceRule())

If I understand the OP requirement's correctly this only works on the first invocation. Let's say the first time around the CrossedUpIndicatorRule part returns false, and the JustOnceRule returns true. We get an overall false and everything is working as expected.

The second time around, the CrossedUpIndicatorRule returns true, but the JustOnceRule returns false (since it's already fired in the past). In this case, we want the overall expression to return true since this is the first time the subject rule (CrossedUpIndicatorRule) is satisfied. Unfortunately this time (and all subsequent times) we get an overall false.

from ta4j.

team172011 avatar team172011 commented on May 19, 2024

"CrossedUp/CrossedDownRule" (which only fires one time as soon as the rule is satisfied and then never again).

That is not correct. CrossedUP/CrossedDownRule fires every time when the value of indicator1 crosses up/down the value of indicator2

If i have understand you correct you can reach your plan without enhance the rule, but by adding the JustRunceRule via .and() conjunction to the rule you want to be satisfied just the first time, like:

Rule myJustOnceRule = new CrossedUpIndicatorRule(indicator1, indicator2).and(new JustOnceRule())

from ta4j.

team172011 avatar team172011 commented on May 19, 2024

Ah, i see -.- .
So @nimo23 approach is correct

from ta4j.

nimo23 avatar nimo23 commented on May 19, 2024

Thanks.

from ta4j.

team172011 avatar team172011 commented on May 19, 2024

I accidentially pushed to develop branch, but you can find the new rule from @TheCookieLab there.

from ta4j.

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.