Backtesting Python Bot with MT5

 
Hello
I write a python bot and it's working fine with mt5.all the functions that i write is correct and i use lib like metatrader5, pandas and ect for my code.
the only problem is backtesting. i know i can write a data loader and reporting system myself with python but it's too much useless work right now.
is there any backtester for mt5 that i can connect my code to it with terminals and other stuffs ?
 

I haven't tried it myself, as I am working completely within metatrader environment,

But I have came across this-

(Video Tutorial)


(Direct youtube link to the above video, because I seem to have problems embedding it in the message)

https://www.youtube.com/watch?v=ovKgQdiQsHE


(The github project of the above tutorial)

https://github.com/mkhushi/MQL5-Python-Backtesting


I would appreciate if you could report back if it did or didn't work,

As I am curious to know, as I myself might migrate the python in the future, but would hate losing the ability to use metatrader's strategy tester.


Good luck mate.

GitHub - mkhushi/MQL5-Python-Backtesting: MQL5 based backtesting using python
GitHub - mkhushi/MQL5-Python-Backtesting: MQL5 based backtesting using python
  • mkhushi
  • github.com
How to run the Strategies: open main_decisionmaker.py and import the trading strategy which is intended to run Update the strategy and the signal line Start the backtesting in Metatrader 5 Copy the python files along with the...
 

hello i am trying to build a bot in python i create vrtual envirmnent then import libraries and now i can able to connect to my mt5 account i try to run code 


mt5.initialize()

fail counldnt go through

name error occured


i try this method too but still fail

mt.initialize(path ="users\shahryar\documents\mt5 bot\bot\venv\lib\site-packages",
   login="000",
   password="000",    
   server="OctaFX-Demo",
   timeout="TIMEOUT",        

   portable="False")


tell me solution i am not coder but i am learning to build a bot for my self. its been 6 month now i am able to get all this thing but on stuck on this please anyone help me out


 
from datetime import datetime
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
import MetaTrader5 as mt5
import plotly.express as px

mt5.initialize()

 
I am currently doing it the same way. Build models and create signal logic using Python and then to perform a backtest, I connect it to MT5 which generates the report as well as Visual mode to see your trades. Saved me 100s of lines of code. 
 
Adeetya #:
I am currently doing it the same way. Build models and create signal logic using Python and then to perform a backtest, I connect it to MT5 which generates the report as well as Visual mode to see your trades. Saved me 100s of lines of code. 

@Adeetya Kindly Explain how you could backtest a python script using MT5 within visual mode. Been trying for a long time now. Thanks

 
Korro0 #:

@Adeetya Kindly Explain how you could backtest a python script using MT5 within visual mode. Been trying for a long time now. Thanks

Hey Korro, I hope you are fine!
Did you succeed? If so, can you explain to me which tools to use?
Thanks!