Meta Trader 5 Expert Advisor coding

I am just wondering if anyone here writes EAs on meta trader 5. Coding has become a bit of a hobby for me, I am a long way off actually using one live though with real money :joy:. I started coding on meta trader 4 and have now transitioned to 5 but I have for some reason been finding it harder.
I opened a Pepperstone account to trade on and I have been using a book called Expert Advisor Programming for Meta Trater 5 by Andrew Young to help me learn. Unfortunately I am finding some of his coding, mainly buying and selling code, does not work as it errors when filling a trade on my Pepperstone account.
Generally though I would start a post about writing EAs if anyone is interested or can help me with the above.

1 Like

Start a post anyway if only for your own self assurance. Marking your own homework is a good start. If others are interested, you can hope they will mark it as well, so you get the independent reviews at no cost to your time. Go for it.


What is the error you are receiving? Walk me through what you’re doing, step by step, so we can sort this out together.

1 Like

Firstly, I’d change to cTrader, coding is much better on there although I find it hard to find what I want in their documentation sometimes.

Are you using the trade class or the more clunky version that doesn’t need to include the trade class? You have to specify the trade type, fill or kill etc in the latter. You can look at the market details for each symbol and see what you need to specify.


Hi Emi,
I get a filling error when I run the code. If you have time I could send you my code if you could have a quick look at it?

Hi Chester,
Yes it’s a ctrade code that the author write in the book. I now used the buy, sell, and modify function from the trade include file that is provided as part of meta trader. That seems to be working fine for me. The next step for me is to try and get some error functionality into my EA to give my EA some robustness. So any advice on that would be appreciated if you have time.

Hi, thanks for your message. And Yes and I hope once I get more knowledge I can help others too… may be a while yet though :sweat_smile:

Sure, I can help! We’re all here to support each other, right? Send over the codes and I’ll see what I can do.

Thanks Emi, I will send you a message.

1 Like

Definitely good (and important) advice!

Haha only problem now is I’m hooked on MT5 coding and I am having lots of fun getting better at it. Now I am getting the hang of it I am finding it a lot easier to code with now, and like the challenge of writing EAs with different indicators.

1 Like

Hi, Tristan. I’m a newbie who is still going through the School of Pipsology, and who eventually wants to learn how to code EAs.

Would you recommend starting with learning Meta Trader 4, or just going straight to Meta Trader 5? If you could go back in time, would you just start with 5, and not even bother with 4?

Thanks for starting this post.

Hi playwiththegods,

I still am a newbie to all this as well, I just found that I have always liked maths and found that I enjoy coding and it’s becoming a bit of a hobbie for me. Meta Trader 5 has a lot more features and can do a lot more than Meta Trader 4, everytime I think I am getting good at it there seems to be more to learn! I wasn’t on Meta Trader 4 for long until I transitioned to MT5. I would go straight to MT5 but I am no expert in this field. Just get a good book to learn from and find some good you tubers to watch. I find Rene Balke really good to watch and he provides a lot of coding examples.

The other platform that would be worth investigating is CTrader as Chester John said above, but I don’t know much about it and haven’t investigated it, it may be easier than MT5 and quicker to learn.

Let me know how you go.


Thanks, Tristan.

I’m into maths and coding, too. I started learning Python this year, and I’m working to get into cybersecurity.

Thanks for the recommendations. I’m excited to get into the book by Andrew Young and the YouTubers like Rene as soon as I finish the School of Pipsology. I’ll probably end up learning MT4, MT5, and cTrader.

I checked out Rene’s channel. I can tell that I’m gonna have a lot of fun geeking out on this stuff. It’s going to be a while before I start posting about my progress.

I’m looking forward to seeing you progress in EA coding with your posts here.


Hi Paul,

Good luck to you with this too. The Andrew Young book is good, it took me a while to understand what he was on about, but after watching some of Rene’s videos, I have recently gone back to Andrew Young’s book and it now makes a lot more sense to me.

I also just purchased Bob Volmans Book Understanding Price action as it was recommended on one of the forums here. it turned up today, looks like a heavy read, lol, I will start reading it soon and see if it gives me some ideas.


1 Like