Risk management is one of the important parts of trading. Nowadays, algorithmic trading helping us to manage our risk per trade automaticly But there is a hard challenge, How much risk should be considered in each trade? This is what we discuss about, we implemented an algorithm that guarantees that margin call never treat your account.
Main idea of this algorithm inspired of TCP/IP Congestion control When there is a certain number of packet loss in connection, sender reduces window size to half and when there is a consecutive acks, sender increases the window size to 2x We proposed an algorithm similar to congestion control to avoid major losses in out trades And it is proved that in this case, if all trades hit stop loss, it doesn't matter because the overall is limited and there is no margin call threat for our balance. you may ask how? Here is the point. If we start out trading with 1% of our balance per trade, and reduce it to half after 4 stop loss, or increase it after 16 rewards. Try it ! Remember it's a Python simulation of original algorithm and you must implement it by your need in Pine or MQL4/5
Just run this two commands in your terminal/prompt:
pip install requirements.txt
python main.py
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.