OHLC and indicator class implementation

Author: Jelle {Cryptobot} 0xe8f

Original Post Date: 4 July 2022

OHLC and indicator class

I think that adding a standardized indicator or OHLC (open-high-low-close) class would provide users with more freedom to develop custom strategies and more easily manage risk in a standardized way.

A couple of examples of how indicators could be used in PMM:

  • Adjust spread based on 1 hour RSI
  • Stop trading if price exceeds 30 minute bollinger bands upper/lower limit
  • Decrease bid spread if the fast-moving EMA fn the MACD is above the slow moving MACD on the 4 hour timeframe
  • Decrease bid spread if price is above the 10 day EMA and RSI < 30

A great example is given in the article below. They used the ROC (rate of change) indicator to minimize the risks of getting adversely selected by informed traders and thereby increased profitability.

There are endless possibilities. But the most important here is the freedom developers/traders get in designing their own strategies by creating simple rules as described above.

This could be achieved by adding an OHLC class that fetches the OHLC data of a specific token/pair on an exchange for a specific duration and timeframe. However, it is important that this process is not requested every tick, but only every x time interval (based on the timeframe specified). The class should simply return the OHLC data so developers/traders can use various python TA libraries (or their own indicators) to design rules for adjusting spread/size etc.

I would like to get your opinion on this idea before submitting this as an HIP

3 Likes

Author: Dardonacci 0x78a

Totally agree with this initiative!

I think that the best way to implement this is using the trades. That will allow users to create time, tick, volume and dollar bars (info in this post about them Financial Machine Learning Part 0: Bars | by Maks Ivanov | Towards Data Science)

I think that it’s also necessary to design a good process to collect historical data to construct this bars before the bot starts.

Another post of information driven bars: https://towardsdatascience.com/information-driven-bars-for-financial-machine-learning-imbalance-bars-dda9233058f0

1 Like

Should this be implemented in the connectors?

I like the idea very much. Mainly in terms of capital management and achieving time management as well.