kecoma1 / Trading_BOT

This is the repository for the trading bot we are building in my youtube channel!
118 stars 85 forks source link

Bollinger.py #1

Closed merwone closed 2 years ago

merwone commented 2 years ago

Hi Kevin,

Big fan of your youtube channel, learnt quite a bit about python thanks to you.

I have a question/request.

How would you create a bollinger.py similar to your MACD.py to keep track and create a signal and operate with your bot/order.py

As an example I found this python code that identifies BB pattern.

Would be great if you could take a look!

kecoma1 commented 2 years ago

Hey Merwone! That depends a lot on the strategy that you have with that indicator. The first step would be taking the indicator values, for this you have 3 options:

Taking data

  1. (Complex) Compute the values by yourself taking ticks, creating functions with the formulas and creating candles.
  2. (Medium) Compute the values with the TA library as it is done here https://github.com/kecoma1/Trading_BOT/blob/main/ta/MACD/MACD.ipynb (it would be a similar process but with the Bollinger Bands indicator. More info about computing the data with TA here https://technical-analysis-library-in-python.readthedocs.io/en/latest/ta.html ). Take into account that you need to take ticks and compute candles.
  3. (Easy) With Sockets and MT5. You can send with MQL5 data to python using sockets I have an example here https://github.com/kecoma1/Trading_BOT/tree/main/MQL5_PYTHON I have done a video of this but it will be published the 6th of april. What I'm doing here is using Python (or any other language with sockets) as a Server, then I create a bot in MQL5 that will act as a client of that server, it will send data to python, in fact, it will send the data that we want. What is the advantage of this? You don't have to compute anything! MT5 has already everything computed and it can send you the data you want, such as more indicators, candles closes, open...

Finding signals

Once you have all the values this would be easy, you need to take those values and find signals depending on your strategy. You can create a function that returns a boolean whether the signal is good or not.

Opening Positions

You have to open a position now, you can use the MetaTrader 5 library for Python. One example of this would be the functions open_buy and open_sell in this file https://github.com/kecoma1/Trading_BOT/blob/main/Python%20trading%20bot/src/orders.py .

I hope this helped!

merwone commented 2 years ago

A lot to digest, thanks for taking the time, looking forward to your next upload.