Candlestick pattern in IB API on c++

Discussion in 'App Development' started by Sivon, Dec 11, 2020.

  1. Sivon

    Sivon

    I wonder if there some way to use c++ IB API for canndlestick patterns. There are functions like "get historical data" etc but they dont return nothing and just output data to concole. I have a few algorithms I backtested in tradingviews Pine Script and they worked very well so I decided to try to test it on IB paper account. Pine Script is very simple to use and there are possibilities to get current and previous bar data like "open", "close" etc easily.
    For example:
    If (low <= low[1])
    strategy.order(id, long, qty, limit, stop, oca_name, oca_type, comment, when)
    If (high >= 100)
    strategy.exit(id, from_entry, qty, qty_percent, profit, limit, losss, stop, trail_price, trail_points, trail_offset, oca_name, comment, when)

    When low of current bar lower than low of previous bar than place order. When high of current bar higher or equal than 100 exit

    Is it possible to do the same in IB API? So far I found class called Bar, but it doesn't have any fuction what can return bar prize.
     
  2. The IB API does not offer functionality to analyze data such as prices. It only contains functionality to get the raw data from the server, get your account information, and send orders (and monitor these). Everything else you have to code yourself, or get the necessary code from another source.
     
    ET180 and Sivon like this.
  3. Sivon

    Sivon

    Thank you! This is sad. I didn't found any 3rd party who can provide a functionality at list like Pine Script. There are some libraries for python like "Pandas" and I have no choise but to use them. There is almost nothing for C++. Only documentation from IB.
     
  4. Snuskpelle

    Snuskpelle

    Candlesticks and indicators for C++: https://ta-lib.org
    Indicators only (but better designed library): https://tulipindicators.org/

    Regular caveat is that little of this stuff has any use in reality.

    Look, depending on what you're trying to do you might be FAR better off using something like QuantConnect's Lean engine (C# or Python), especially since that A) has support for Interactive Brokers and you can even run your own local server if you like for free, B) has the high level features you are requesting. Dropping the link in here: https://www.quantconnect.com/
     
  5. ZBZB

    ZBZB

  6. ET180

    ET180

    And that's the way it should be. I don't want to pay IB for analyzing patterns or add bloat to their software to add the indicators.
     
    HobbyTrading likes this.
  7. 931

    931

    IMO ib api is not hard to implement to feed data to custom software , or post orders.
    At least not compared to building strategies.
     
    ET180 likes this.
  8. I agree with you. I prefer to do my analysis myself, so that I know exactly how it is calculated. Without using any "black boxes" of which I don't know what happens inside.
     
    ET180 likes this.
  9. rodras

    rodras

    Hi Sivon,

    In order to make use of the reqHistoricalData function, you must change the TestCppClient script which I suppose you are using to return the requested data into a list or, preferably into a data frame instead of printing it to the console.

    Only after storing the data (OHLC) you can make any use of it to program some kind of pattern recognition and to act on it.