Giter Site home page Giter Site logo

jettynie123 / ta4j-strategy-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from massigerardi/ta4j-strategy-parser

0.0 0.0 0.0 16 KB

a library to parse Technical Analysis strategies into ta4j using antlr4

License: MIT License

ANTLR 9.46% Java 90.54%

ta4j-strategy-parser's Introduction

ta4j Strategy Parser

ta4j Strategy Parser is a library to parse Technical Analysis strategies into ta4j using antlr4.

Strategies

Strategies are defined as combination of GO_LONG and GO_SHORT combined signals.

A signal could be a combination of indicator expressions and logical expressions.

(((DEMA[5] >= SMA[45]) OR ((TEMA[30] <= 1.3) OR ((DEMA[74] >= 0.3637) OR (CCI[30] <= 0.5)))) AND ((TEMA[30] <= 1.3) OR ((DEMA[74] >= 0.3637) OR (CCI[30] <= 0.5)))) [GO_LONG] 
; 
((TEMA[30] <= 1.3) OR ((DEMA[74] >= 0.3637) OR (CCII[30] <= 0.5))) [GO_SHORT]",

Logical expressions must be inserted between parentheses

  • correct
((DEMA[74] >= 0.3637) OR (CCII[30] <= 0.5))
  • incorrect
(DEMA[74] >= 0.3637) OR (CCII[30] <= 0.5)

Use

import org.ambulando.strategy.ta4j.parser.*;

    ...
    String input = "(RSI[5] <= 7.5) [GO_LONG] ; (CCII[5] >= 7.9) [GO_SHORT]";
    try
    {
      BarSeries barSeries = getBarSeries();
      Strategy strategy = parser.parse(input, barSeries);
    }
    catch (ParserException e)
    {
      List<ParserError> errors = e.getErrors();
      //handle errors
    }
    ...

Operators

  • Logic operators between signals
    • OR
    • AND
  • mathematical operators between indicators:
    • >=
    • <=

Indicators

Use of the indicator can be found in ta4j docs At now, the following indicators are recognized by the parser:

INDICATOR USE
Close Price CPRICE
Volume VOLUME
Simple Moving Average - SMA SMA[timeframe:int]
Double Exponential Moving Average - DEMA DEMA[timeframe:int]
Exponential Moving Average - EMA EMA[timeframe:int]
Triple Exponential Moving Average โ€“ TEMA TEMA[timeframe:int]
Weighted Moving Average WMA WMA[timeframe:int]
William's R - WILLIAMS WILLIAMS[timeframe:int]
Commodity Channel Index - CCI CCI[timeframe:int]
Relative Strength Index - RSI RSI[timeframe:int]
Ulcer Index - UI UI[timeframe:int]
Average Directional Index - ADX ADX[timeframe:int]
Hull Moving Average HMA HMA[timeframe:int]
Zero-Lag Exponential Moving Average - ZLEMA ZLEMA[timeframe:int]
Kaufman's Adaptive Moving Average - KAMA KAMA[timeframe:int,timeframe:int,timeframe:int]
Moving Average Convergence Divergence - MACD MACD[timeframe:int,timeframe:int]
Percentage price oscillator - PPO PPO[timeframe:int,timeframe:int]
Volume-Weighted Average Price - VWAP VWAP[timeframe:int]
Chaikin Oscillator - COI COI[timeframe:int,timeframe:int]
Accumulation Distribution - ADI ADI
Intraday Intensity Index - III III
Chaikin Money Flow - CMF CMF[timeframe:int]
Moving Volume Weighted Average Price - MVWAP MVWAP[timeframe:int,timeframe:int]
Negative Volume Index - NVI NVI
Rate Of Change of Volume - ROCV ROCV[timeframe:int]
Positive Volume Index - PVI PVI
On Balance Volume - OBV OBV

ta4j-strategy-parser's People

Contributors

massigerardi 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.