Comments (5)
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.
"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.
Ah, i see -.- .
So @nimo23 approach is correct
from ta4j.
Thanks.
from ta4j.
I accidentially pushed to develop branch, but you can find the new rule from @TheCookieLab there.
from ta4j.
Related Issues (20)
- DecimalNum: reduce DEFAULT_PRECISION from 32 to 16 or less HOT 2
- [BUG] ParabolicSarIndicator throws NPE from getValue() method HOT 4
- AverageReturnPerBarCriterion: formula HOT 4
- How to identify flat n market or maybe whole bollingers strategy ? HOT 2
- Make BinaryOperation public
- logback 1.3.x supports the Java EE edition (jdk1.8) οΌIs it possible not to upgrade to 11οΌ HOT 9
- Pyramid Trading - Scaling into a position - DCA Trading possible ? HOT 10
- LagIndicator HOT 2
- KDJ
- [BUG] Reviewing process does not work as promised HOT 2
- TradingRecord#getLastPosition(): improve code
- Possible RSI bug HOT 7
- Does the lib support Other TimeFrames HOT 1
- Amount field in the BaseBar class HOT 1
- [BUG]ConvergenceDivergenceIndicator always returns false on 500 data sets with 500 bars each HOT 1
- [BUG] Supertrend Indicator value goes to 0 and stays 0 forever HOT 2
- Zig Zag indicator implementation question HOT 3
- Create releases more often HOT 17
- Trade style specific question [Support and resistence] HOT 8
- Can ta4j backtest trading multiple stocks simultaneously HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ta4j.