Python or MQL5 — Code Migration

 

Dear support team,
 
I hope this message finds you well!
 
My team is looking to migrate our highly profitable trading algo to another home and we are trying to find what platform will provide the most benefits. The following are some questions we still need answers to that we have been unable to find reliable information on.
 
A portion of our migration will need to involve building our own candle manipulation system from standard candles to something we have created. It appears none of the community scripts is satisfactory enough to do so and we are planning to write our own source code. Do you recommend we develop this code in python or mql5? Our main goal is to have a VPS algo do trades based on how our new candles form.

EDIT: We are trying to determine if we should migrate our entire algo into a strictly python base code and interact with your VPS system that way, or if its better to create indicators in MQL5 and do Order Management via Python, or if we should create everything in one language. The main focus on our algo will need to have as little lag as possible for when we initiate a buy/sell order and when it gets executed.

I appreciate your time.
 
Best Regards,
João Valério

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

I recommend MQL5 without a doubt.

Python is interpreted and slow compared to MQL5 which is compiled.

MQL5 also gives you direct access to much more of the platform's inner functionality, while Python has to remotely go through an API, which communicates via named pipes, and is limited in functionality.

Also, to make use of MetaTrader's Strategy Tester, it's Cloud and VPS services, etc. you need to use MQL.

PS! This is a user forum. MetaQuotes does not directly support users, only brokers. We the users, are your direct line of peer support.

 
3195512:
Dear support team,
 
I hope this message finds you well!
 
My team is looking to migrate our highly profitable trading algo to another home and we are trying to find what platform will provide the most benefits. The following are some questions we still need answers to that we have been unable to find reliable information on.
 
A portion of our migration will need to involve building our own candle manipulation system from standard candles to something we have created. It appears none of the community scripts is satisfactory enough to do so and we are planning to write our own source code. Do you recommend we develop this code in python or mql5? Our main goal is to have a VPS algo do trades based on how our new candles form.

I appreciate your time.
 
Best Regards,
João Valério

if the strategy is ready to trade then mql5 

otherwise the pytorch + aws is very appealing and superior for optimization if you choose python but also more expensive.

Having custom bar structures means you'll need to deploy custom test algorithms .

If you'll try to use the GPU for the strategy tester you will need to tailor OpenCL kernels to your test.

In contrast pytorch is widely supported and documented and ready to go in AWS 

edit :

*Theres also the mql cloud which is what aws is more expensive than 

 
Thank you for the help!
Fernando Carreiro #:

I recommend MQL5 without a doubt.

Python is interpreted and slow compared to MQL5 which is compiled.

MQL5 also gives you direct access to much more of the platform's inner functionality, while Python has to remotely go through an API, which communicates via named pipes, and is limited in functionality.

Also, to make use of MetaTrader's Strategy Tester, it's Cloud and VPS services, etc. you need to use MQL.

PS! This is a user forum. MetaQuotes does not directly support users, only brokers. We the users, are your direct line of peer support.

Lorentzos Roussos #:

if the strategy is ready to trade then mql5 

otherwise the pytorch + aws is very appealing and superior for optimization if you choose python but also more expensive.

Having custom bar structures means you'll need to deploy custom test algorithms .

If you'll try to use the GPU for the strategy tester you will need to tailor OpenCL kernels to your test.

In contrast pytorch is widely supported and documented and ready to go in AWS 

edit :

*Theres also the mql cloud which is what aws is more expensive than 

 

In case I want to build AI systems by using Python, which is the only option, would I be able to have the Python file communicating with a MQL5 file? Or it is advisable to build all the trading robot system in the same programming language?

I appreciate your time.
 



My team and I are in the process of migrating a strategy to your platform and have some questions regarding the reliability of the MT5 backtesting tool.

We are currently using data from AMP, which includes bid, ask, volume, and last price per tick. From my understanding, this represents the highest level of market depth available. Can you confirm if this is correct?

Additionally, could you recommend any resources or articles that explain how backtesting works in detail, particularly in relation to how closely backtest results compare to live trading outcomes?
Personally, I define backtesting as a 
market replay with real full depth market (including the 100% of transactions).

Thank you for your time and assistance.

 
3195512: In case I want to build AI systems by using Python, which is the only option, would I be able to have the Python file communicating with a MQL5 file? Or it is advisable to build all the trading robot system in the same programming language?

MT5 offers a Python API for direct interaction. There is no need for it to "communicate with a MQL5 file".

I suggest you take some time to study the documentation and book which has already been referenced.

Also, please don't start a new topic for related questions. Post in this existing topic and continue the discussion here.

Python or MQL5 — Code Migration
Python or MQL5 — Code Migration
  • 2024.10.02
  • 3195512
  • www.mql5.com
Dear support team, I hope this message finds you well...
 
3195512:
My team and I are in the process of migrating a strategy to your platform and have some questions regarding the reliability of the MT5 backtesting tool.

We are currently using data from AMP, which includes bid, ask, volume, and last price per tick. From my understanding, this represents the highest level of market depth available. Can you confirm if this is correct?

Additionally, could you recommend any resources or articles that explain how backtesting works in detail, particularly in relation to how closely backtest results compare to live trading outcomes?
Personally, I define backtesting as a 
market replay with real full depth market (including the 100% of transactions).

As already stated before, please don't start a new topic every time, when the question is related and a continuation of a previous topic. I have merged your topics into this one.

As already stated in my post #2, and considering that you decided to go the the Python route, then you will not be able to use MetaTrader's Strategy Tester. That is strictly for MQL programs only.

For Python you will have to develop your own back-testing system or search for an existing system that someone else might have implemented.

Also, again, I call your attention to reading and learning from the documentation and the book. Physically familiarised yourself, working with MetaTrader in real live usage, and experimenting with things yourself.

 
3195512: EDIT: We are trying to determine if we should migrate our entire algo into a strictly python base code and interact with your VPS system that way, or if its better to create indicators in MQL5 and do Order Management via Python, or if we should create everything in one language. The main focus on our algo will need to have as little lag as possible for when we initiate a buy/sell order and when it gets executed.
You cannot run Python code on MetaQuotes VPS system. That is strictly for MQL programs only. You would need to use a 3rd party VPS if you wish to run Python on it.
 

Thank you for the help!


1. We already have a startegy working in MQL5. Nevertheless, later we would like to build an AI to work alogn with this strategy. We will use the 'Python API for direct interaction'.


2. Since we chose the MQL5 path, could you clarify us regarding the backtesting please? Let's ignore the Python API part and consider only the MQL5 strategy we currently have.

'My team and I are in the process of migrating a strategy to your platform and have some questions regarding the reliability of the MT5 backtesting tool.


We are currently using data from AMP, which includes bid, ask, volume, and last price per tick. From my understanding, this represents the highest level of market depth available. Can you confirm if this is correct?

Additionally, could you recommend any resources or articles that explain how backtesting works in detail, particularly in relation to how closely backtest results compare to live trading outcomes?
Personally, I define backtesting as a 
market replay with real full depth market (including the 100% of transactions).'


Best Regards,

João Valério

Fernando Carreiro #:
You cannot run Python code on MetaQuotes VPS system. That is strictly for MQL programs only. You would need to use a 3rd party VPS if you wish to run Python on it.
Testing trading strategies on real ticks
Testing trading strategies on real ticks
  • www.mql5.com
The article provides the results of testing a simple trading strategy in three modes: "1 minute OHLC", "Every tick" and "Every tick based on real ticks" using actual historical data.
 
3195512 #: Additionally, could you recommend any resources or articles that explain how backtesting works in detail, particularly in relation to how closely backtest results compare to live trading outcomes?
Personally, I define backtesting as a 
market replay with real full depth market (including the 100% of transactions).

It is impossible to distil in a fee lines all the ins and outs and intricacies of how to use the Strategy Tester. That is why there is documentation for you to read and apply. That is why there is a dedicated book to help programmers understand the documentation more easily with practical examples.

The reliability of the Strategy Tester is highly dependant on the the coder's skill and experience, both in programming, in trading and the use of the Strategy Tester. It will be impossible for you to gain that knowledge and experience in a few lines of text, or few days of experimentation. It takes time and dedication.

The Strategy Tester is a tool, just like a chisel and hammer are tools in the hands of a sculpture. The master will be able to sculpt wonderful pieces of art, while a the novice will produce junk, both with the exact same tools.

The same applies here. The Strategy Tester is only as good as the person wielding it. So, read the documentation, apply the knowledge, test, study, adjust, repeat.

As you progress, ask specific questions that can be answered objectively and simply. Progress and gain the skill and experience to master the Strategy Tester.

Also, take some time to search through the Articles section. Some are outdated and some more recent, but there is valuable information in there that should help you out as well.

MQL5 Articles
MQL5 Articles
  • www.mql5.com
MQL5 Programming Articles