Writing a profitable trading bot

 
Hello friends,

I have been working on a forex trading bot this summer in the prospect of financial freedom for me and my family also because I like the challenge.
I have tried a few trading strategies which are mainly based (Exponential) moving averages combined with RSI on the 1 and 5 minute timeframe.

To me it seems the market is very much just random too random to actually make a profit, it never seems to have one direction and prices shoot around all over the place.

for example I tried the 8-13-21 EMA crossover on the 5 minute timeframe and it does not turn a profit.
Also the 25-50-100 EMA crossover on the 1 minute timeframe is not profitable so far running on demo accounts most of the day.

I looked up on:<Deleted>

For some examples and I noticed many expert advisors use gambling strategies like grid trading and martingale.

Now I start to wonder is forex trading actually gambling or is it even possible to write a profitable expert advisor without risking the whole account?

If it would be very profitable what kind of strategies are being used, what timeframes are being used?
Or is just all some kind of hoax because I have not heard of many people becoming rich because of trading algorithms?

Please let me know if you have some valuable information or view on this topic
 
Uff, that's such a long topic.

Statistical approach to trading is one aspect.

Technical analysis is another.

Risk and probability is as important as understanding the math of the financial assets.

Markets are a result of mass psychology.

Markets are random.

Any of the above statements is a rabbit hole that needs to be explored, depending on what you are looking for.

If you would like to get an understanding of trading systems, learn and research "Ichimoku". It is a complete trading system. As you begin to understand that, you will begin to understand the size of what you are trying to achieve.

It's not like doing it in one summer. It's a life dedication. You will have to understand, if it were easy, everyone would be doing it. It is simple, but not easy.

Experience is gained by persistence.

Building a profitable algorithm requires you to have a trading strategy that already works and you understand in all details.

Sorry to disappoint you, it's not EMA, nor RSA or any other of those.

Depending on your approach, indicator based, price action based, fundamental based... Make your choice.

But one thing you could strat with, trade manually. Find your way into the charts and prices.

Just to give you confirmation, yes algorithms exist, providing massive amounts of profits every day. - It's rare, it's for sure unshared, it's difficult to create.

I wish you success in your endeavor.
 
Dominik Christian Egert #:
Uff, that's such a long topic.

Statistical approach to trading is one aspect.

Technical analysis is another.

Risk and probability is as important as understanding the math of the financial assets.

Markets are a result of mass psychology.

Markets are random.

Any of the above statements is a rabbit hole that needs to be explored, depending on what you are looking for.

If you would like to get an understanding of trading systems, learn and research "Ichimoku". It is a complete trading system. As you begin to understand that, you will begin to understand the size of what you are trying to achieve.

It's not like doing it in one summer. It's a life dedication. You will have to understand, if it were easy, everyone would be doing it. It is simple, but not easy.

Experience is gained by persistence.

Building a profitable algorithm requires you to have a trading strategy that already works and you understand in all details.

Sorry to disappoint you, it's not EMA, nor RSA or any other of those.

Depending on your approach, indicator based, price action based, fundamental based... Make your choice.

But one thing you could strat with, trade manually. Find your way into the charts and prices.

Just to give you confirmation, yes algorithms exist, providing massive amounts of profits every day. - It's rare, it's for sure unshared, it's difficult to create.

I wish you success in your endeavor.

Thank you Dominik!

I tried trading manually but it was emotionally too taxing that's why I came up with the idea to program the whole thing. Also trading is time consuming and computers are way faster and never sleep.

But since i am very interested to know what trading system was most profitable to use for you based on price action only?

What key recommendations would you make for designing one that would be simple and reliable?

Does it include indicators for relative price strength and direction or for example trading breakouts or grids?

 
Magus I #: But since i am very interested to know what trading system was most profitable to use for you based on price action only? What key recommendations would you make for designing one that would be simple and reliable? Does it include indicators for relative price strength and direction or for example trading breakouts or grids?

Based on my own experience, I find that the most important aspect of having a consistent and profitable strategy, is how you handle your risk and your money. I would rate the importance of different aspects as follows:

  1. Risk & Money Management (maximum importance and most essential part of all the strategy rules).
  2. Exit rules.
  3. Entry rules (least important).

Read the following too ...

Forum on trading, automated trading systems and testing trading strategies

EA printing values that shouldn't be there

Fernando Carreiro, 2022.06.10 22:50

As I stated, both at the same time may not be possible!

When I started with MQL, I was already an established software developer with 30 years of experience. But even then, I approached it the way I described. Even with my solid background in C and C++, MQL was not just about coding. It also had to do with the MetaTrader platform and trading concepts, and those were totally new to me.

Many of the strategies I had in the beginning eventually got bashed away by the reality that trading can differ totally from what one thinks it is in the beginning. I came up with very elaborate stuff, only for them to be ultimately thrown in the bin because I was naïve.

As I progressed, I realised that my trusted friend in coding, namely K.I.S.S. (Keep it simple, stupid!), is just as relevant in trading as it is in much of anything else in life. Complex strategies are useless and just distract us from what is really important.

As time went by, my strategies became simpler and my EAs become more refined. However, to my surprise, over time, money and risk management became the central theme of it all. It gradually became clear to me that entry rules were not all that important, but exit rules, risk and money management can make or break a strategy and became paramount for me.

In essences, almost any indicator gives approximately the same signals, given that they all derive those signals from the price action itself. So you might as well stick to the simplest and cleanest of indicators and concentrate on the exits, risk and management of the trades.

With that in mind, I decided that my code should be simple, clean and efficient, and focus on the risk and trade management and very little on the indicators and signals they generate.

This is my advice to you. Learn to code MQL and understand the platform and trading, methodically and properly, because as you do, you might find that your current strategy is going to end up in the trash bin.

NB! My journey with trading and MQL took me years (not months), to get to a level I could be happy with.


 
The only indicator of use for me is the ATR. Anything else is made up on price action and that can be quite successful.

There are multiple sources of worth to get some overview on this. One is IPDA another is ICT, both use pure price action.

If you are more the indicator guy, I suggest listening to VP from no nonsense forex.

A combination of both, as well as aspects from Elliott (Wave) can be found in Ichimoku. (Already suggested that).

Else, you will need to find your own approach to markets anyways.

There are also some very interesting lectures about finances from MITs online courses. Some of them point out the maximum possible output from markets, compared to your input in form of risk...

There is a massive sea of information out there, but get used to it being dry material. Any juicy stuff I would personally avoid. Claims of high profits are a very good indication to stay away from that.

Else, you can also study some of the institutional approaches to markets. They differ alot and some methods can teach you why markets behave in certain ways.

The issue with getting your emotions in the way, is a question of having a written!!! system.

Take a demo account, test what you are doing. Your system should be simple. Not easy, but simple.

Have straight rules in place, for all aspects of what you are doing. - Else you are set up to fail. Guaranteed.

And also expect to take your time on it, you need (as any profession) to walk the walk. It's at least a few years in, but it will be rewarding, if your goal is to be a successful trader.

As you can see, automated or manual is not as relevant as walking the tough way through learning.


 
I would say that to be profitable you need years… not months … in few months … with enough dedication and work, you can be a decent coder, and you can make money in a freelance section… more then from trading… for trading you need a lot of chart time … as it has been said… you start on a demo account… try some manual trading … do some reading…
Take some courses for basic stuff… and then chart time… A LOT… once you are a little profitable on demo… switch on real account … with a little money… on demo you will never feel the pain… but with little real money you will start to educate yourself… you need to learn to maintain the same level of emotions when you have +200 or -200 on a trade… but before that you will start with handling -5 USD on a trade… this is how you educate your emotions … your strategy will refine on small real accounts … and if you are profitable on trading manually…
The try to automate that… if it is an indicator based strategy… you can automate… like if you can develop a indicator based strategy , that you can easily automate… but if you hope that you can design EA which you will plug in and then leave happily ever after…I think you are wrong… you will see plenty strategies on the internet… none of them working on a long term… unless you are there to adjust… as you will see… you make an EA which is profitable on one pair … you put it on a different pair, all negative… Tweek it and then it works on that pair now… it will not work after 2 weeks… or a news is coming and breaks your little profit… and many many situations… I would say that EA can monitor and handle your trade after you opened it… as a utility … HANDLE YOUR TRADE… not trade for you… 
 

All you need is a Proven Strategy that has a Positive Expectancy, no need to think of the MOST profitable, but it's still hard. And don't risk more than 2% to 3% of your portfolio per trade. And you will go to the moon because of the leverage, just in case you found a proven positive expectancy strategy. Again, it's hard and you need to learn and try different trading techniques.

I am 5 months into this and I am still trying new things. I only trade 0.01 lots(occasionally 0.02) with my cent automated account. The best I could archive with my automated account was +8% when Yen was dropping, and that algo is not currently working after Jul.14th. And now my automated account is at -12%. 

 
Magus I:
Hello friends,

I have been working on a forex trading bot this summer in the prospect of financial freedom for me and my family also because I like the challenge.
I have tried a few trading strategies which are mainly based (Exponential) moving averages combined with RSI on the 1 and 5 minute timeframe.

To me it seems the market is very much just random too random to actually make a profit, it never seems to have one direction and prices shoot around all over the place.

for example I tried the 8-13-21 EMA crossover on the 5 minute timeframe and it does not turn a profit.
Also the 25-50-100 EMA crossover on the 1 minute timeframe is not profitable so far running on demo accounts most of the day.

I looked up on:<Deleted>

For some examples and I noticed many expert advisors use gambling strategies like grid trading and martingale.

Now I start to wonder is forex trading actually gambling or is it even possible to write a profitable expert advisor without risking the whole account?

If it would be very profitable what kind of strategies are being used, what timeframes are being used?
Or is just all some kind of hoax because I have not heard of many people becoming rich because of trading algorithms?

Please let me know if you have some valuable information or view on this topic

It is certainly possible - Jim Simons could be considered one of the most successful people in this field and there is book about him: The Man Who Solved the Market: How Jim Simons Launched the Quant Revolution. While it may not reveal exactly how to do it, it does give some insight into his journey.

Another person to read about is Rich Dennis, who bet his stellar reputation on being able to train novices how to trade using his method (rather than automated algo). He achieved it and it is even taught as a case study in some business schools. A book on that is: The Complete TurtleTrader: How 23 Novice Investors Became Overnight Millionaires

Fortunately for us, platforms like MetaTrader exist making the journey somewhat easier rather than having build from scratch (like Jim Simons), and there are so many books about trading in MT which can show you the way (just search Amazon).

So if you are willing to put in the long term effort, as mentioned by others above, you may well find what you are after

 
Magus I #:

Thank you Dominik!

I tried trading manually but it was emotionally too taxing that's why I came up with the idea to program the whole thing. Also trading is time consuming and computers are way faster and never sleep.

But since i am very interested to know what trading system was most profitable to use for you based on price action only?

What key recommendations would you make for designing one that would be simple and reliable?

Does it include indicators for relative price strength and direction or for example trading breakouts or grids?

Hi Magus, you can build EA based on price action, but first you have to know how it works and what you are looking for, because price action is very discretionally method. Also please note that, market on different currency pairs/metals/indexes and time frames behave in different way, so own research seems neccessary. Regards Greg

 

Here is a strategy that you can code that's already been tested.

Robust systems have very few parameters to test.


https://www.youtube.com/watch?v=mrU-L9KzwcA

Hacked 2 Period RSI Trading Strategy Forex GREAT RESULTS!
Hacked 2 Period RSI Trading Strategy Forex GREAT RESULTS!
  • 2022.07.17
  • www.youtube.com
In this video I use a 2 Period RSI (Relative Strength Index) to test a FOREX Trading Strategy. I got the idea from a recent video from Scott Welsh. I liked...
 
maximo #:

Here is a strategy that you can code that's already been tested.

Robust systems have very few parameters to test.


https://www.youtube.com/watch?v=mrU-L9KzwcA

That's interesting. Thank you.