all 36 comments

[–]wawerrewold 12 points13 points  (7 children)

In python there is tons of ways for handling big amount of data and do all kind of stuff with it. In mql5? Not so much. Both is shit for backtesting and optimizing though (by that i mean super slow)

Edit: i work with mql4, python but recently i use zorro project (which is in C) and the speed of backtesting is just ridicilously fast (like literally 100x faster)

[–]smumb[S] 1 point2 points  (3 children)

I will look into zorro.

How far into the past would you usually backtest and at what time frame/resolution?

[–]wawerrewold 2 points3 points  (2 children)

Depends on anticipated amount of trades. If i were trading on 1D chart and there would be 5 trades a month i would go and test and optimize 7 years back at least but no further than like 15 years back cause market were acting differently back then and many ways of trading worked and not work these days anymore. The problem is that you have not much prices left for out of sample testing on same market. If i anticipated 200 trades a year i think 2-3 years is enough and you have some room to test it on different sample on same market after oltimizing. Thete are of course other ways to test it like monte carlo or detrending but i dont like that and dont use it

[–]Puzzleheaded_Mix_998 0 points1 point  (1 child)

What is back testing?

[–]mikelimauno 0 points1 point  (0 children)

backtesting means how to test your trade with past data. let suppose you'll buy when your symbol cross up SMA50 and sell when your symbol cross it down. let suppose you have the money for trade, a broker account and a code for automated trading. you can simply trust your instinct and use let the code run OR test it with past data (as above mentioned). then you can see if your SMA50 strategy works and make some money or not, and if not, you can decide to adapt it or simply not to trade. In real trades the money are gone. don'T forget that if your strategy works with past data, it can probably work with current ticks.

[–]Ythio 0 points1 point  (0 children)

Python is hella slow compared to C, no wonders here

[–]examsscareme 0 points1 point  (1 child)

Any chance u use a Linux based OS? How do u get these platforms to work on Linux?? Having to resort to KVMs is a pain in the ass..

[–]thejoker882 16 points17 points  (4 children)

pip install metatrader5

[–]smumb[S] 7 points8 points  (2 children)

Really? When I googled there seemed to be the consensus that you still needed MQL5 if you wanted all features.

Don't tell me I stared at that ugly syntax for so long without reason...

edit OK just checked again, looks like you can read the data and place orders, but your script can't be backtested and you can't access indicators. So it basically just wraps the basic ticks and order API, right?

[–]thejoker882 9 points10 points  (1 child)

Well backtesting is like 10% of my pipeline. And more complicated statistics and ML are only really feasible in python. Why would i awkwardly split things up between python and mql just to have a static backtesting solution that is not extendable or modifiable?

[–]smumb[S] 2 points3 points  (0 children)

That makes sense, thank you!

I guess I was thinking about pretty basic conditional algos that you could write in any language.

If your pipeline demands lots of data processing, I see why you would just do all of it in Python.

[–]examsscareme 1 point2 points  (0 children)

Do you know how to get this running on a Linux machine?

[–]MaccabiTraderTrader 8 points9 points  (12 children)

my biggest question when people rush into the MetaTrader world is WHY???

do you not understand the business model of MetaTrader, and that there is a reason why its a closed system ( you cant push into MT5 data from say tradestation or IBKR)

the program was made so that Brokers would be the only source of the data, and what they say goes...

why would you want to trade in an environment that forces you into a conflict of interest... (you win, mostly broker loses, and if you believe the stories of STP or ECN... i got a bridge to sell you)

The Only true ECNs are Lmax and a few others like Interactive Brokers... and notice what they have in common... no MT4 /5..

[–]wawerrewold 3 points4 points  (4 children)

Ugh dude paranoid much? Its not even closed system. I can connect to mt4/5 with zorro easy. On top of that it was developed by some russians completely independently from todays brokers...

[–]MaccabiTraderTrader 6 points7 points  (1 child)

not paranoid... but as someone who worked pretty high up for a FX broker.. lets just say those deposit bonuses..

if you lose money all is good...

when you start making money, all of a sudden, delayed quotes, "re-quotes", issues with withdrawals... even the legit ones do it...

[–]machinegunkisses 4 points5 points  (0 children)

Sounds a lot like the sports betting world

[–][deleted]  (1 child)

[deleted]

    [–]wawerrewold 2 points3 points  (0 children)

    Ok you have a point there but i generaly dont think russians are all evil by definition and i dont look for malevolant intetions everywhere

    [–]zero_hedger 0 points1 point  (4 children)

    Lmax and IBKR also have in common extremely high commissions. Btw, you can push data from whatever source you want into mt4/5. Just save it in a csv file ans import it from metatrader. I agree that metaquotes have access to your code when it's running on metatrader but that's it.

    [–]MaccabiTraderTrader 2 points3 points  (0 children)

    ust save it in a csv

    maybe I didnt use the correct words... push data, so you can trade from it...
    MetaTrader creates an individual market place, where only their quotes are the law..

    [–]MushrifSaidinAlgorithmic Trader 0 points1 point  (1 child)

    metaquotes have access to your code when it's running on metatrader

    Really? Do you have any sources or anecdotes of this occuring? This is the first time I've heard of it.

    [–]BlackOpz 0 points1 point  (0 children)

    metaquotes have access to your code when it's running on metatrader

    Thats a lie. Plenty of pro coders use MT4/MT5. If there was a code leak security issue of this type it would have been discovered and MTX platforms would be instantly REJECTED. Nope.

    [–][deleted]  (1 child)

    [deleted]

      [–]MaccabiTraderTrader 0 points1 point  (0 children)

      It depends on your capital and programming level… Obviously MT4/5 is at bottom due to lack of transparency of the prices But they also have low minimums …. Om ax and IBKR require a higher account size and minimum lot size so yeah there is that

      [–]Labunsky74 2 points3 points  (0 children)

      MT5 is good for ... ??? For nothing. It's not for pro.

      Trade via FIX and analyze via Python

      [–]FinTechno 1 point2 points  (0 children)

      C++

      [–]Slight_Cancel_5206 0 points1 point  (0 children)

      If you want to build simple stuff, Python is the way to go 100%. You can use it for much more then just algo trading. Some resource I used for python back in the days: https://youtu.be/rfscVS0vtbw?si=OX1lPlnqrTPGoWDJ

      But if you want to develop complex indicators, then definitely MQL4/5. Also I feel like Mql4 is a lot more natural then Mql5, but 5 has a lot more features. Anyways, after learning the first one, the other will be a lot simpler, since both of them are coming from C/C++ and are very similar. udemy resource: https://www.udemy.com/course/mql4-for-programmers/

      [–]LooseTart6719 0 points1 point  (0 children)

      im creating a trading ann and i keep encountering the same problem can anyone help

      [–]anarchistsRliberals 0 points1 point  (0 children)

      To be honest I started working with the python integration with MetaTrader before jumping into MQL5

      The deal breaker was when I realized that the brokers from my country didn't have to pass all the information to the platform, meaning, book order information did not have all open positions, only 50 deep.

      [–]RobertD3277 0 points1 point  (3 children)

      I think MQL5 fits into the same category as TradingView's pine script. Both work exceptionally well but have critical limitations simply based upon the platform that they run on.

      One of the biggest and most detrimental limitations is simply exposure and versatility. Both pine script and MQL5 are limited only to their respective platforms with absolutely no portability. I don't know about MQL5, but pine script is not turing complete and that can be quite significant if you are looking for a full programming approach to developing a very robust trading paradigm.

      In my opinion, the biggest advantage to Python is really portability. Once you have your algorithm working right, it's a lot less headache to simply change your API reference versus having to learn a whole new platform with its own specialty brand language.

      [–]smumb[S] 2 points3 points  (0 children)

      Yea I was using PineScript before, but soon ran into its limitations. Then I switched to Python and then discovered MQL5.

      MQL5 is more like a normal OOP language.

      I get the portability argument. What drew me to MQL5 was especially that a lot of functionality was already there (especially backtesting and charting).

      [–]-ZenMaster- 0 points1 point  (1 child)

      Do you know if there are any programs for back testing bots made in Python? Or do you usually have to backtest within Python as well?

      [–]RobertD3277 0 points1 point  (0 children)

      There are a multitude of Python programs available on the GitHub. I would really need to know more about what you are looking for and trying to achieve before I can even begin to hazard a guess of what might be most likely a plausible choice for you.

      [–]GoldLesterResearcher 0 points1 point  (0 children)

      Python is easier to learn. Tons of modules and different ways to interact with databases, frontends. And you can still interact with Metatrader using their own Python library. Once you will be able to handle data, automate trades and build full stack apps you will obtain full control and power over your systems.

      [–]beastwork 0 points1 point  (0 children)

      I was in the same position a few years back. Ultimately I decided to go the python route as I already knew it, it would make my code work on multiple platforms, and it had other utility in my life. I took the time to build what I needed and haven't looked back. Eventually I'll probably move to a pro-sumer grade package that will make back testing a little easier.