What type of content do you want to see next? Do you want to see more code examples on different algo trading strategies? Do you want to see more backtests, strategy analysis or live trading? Or do you prefer to go more in-depth into the actual code? Please let me know and have a great day :).
Hi there.. do you always run your code directly on demo account, or did you some backtesting before dropping the code on the account.? If you did backtesting it, how did you do it.?
Thek you very much, I follow up on your content and it interested me. For the next content, can you show the example code of GRID trading with Martingale strategy?
I was knocked out by stop loss. But the indicator conditions were satisfied and the robot sent again the order. Again, the stop loss was knocked out so that it did not continue. You need to write a timeout for 1 hour in the code, for example. until the news spike passes
great tutorial .though I encountered an error 'IndexError: single positional indexer is out of bounds' which occured between lines 93 and 121.I need your help debugging this please.
I am new to Trading with Python but I wonder is there a more efficient way than to check for a signal with an infinite loop? Because therefore it requests the former close price many times per second but actually it would be enough to get the close price only when a bar is closed (so once a minute in your example).
Salute Great content .. Am trading local Stokes and am trying to figure out if it is possible to create a price alert bot if non of the brokers in my area are featured on mt5. Thanks in advance
for me this doesnt work because you are setting the last close bar > sma to signal buy and vice versa. it doesnt mean buy when the price is above the moving average and sell when it is below the sma. when i run this code it sells when the last close bar of a timeframe specified if it is below the sma then sell and above then buy. when i look on your screen it seems your code runs differently for some reason.
Hi i have created sma cross over strategy on 5 min timeframe and i am getting tick by tick data but i need some help to updat code of one logic can ypu help me the same . I am happy to share the code
It return me an error inside the function definition "signal()", it say to me "index out of bound", is it correct to change iloc[-1] with iloc[0] to target the first element?
Love your videos! to the point, have you ever done a bot that can choose a strategy based on a market condition, e.g. trending or ranging market then choose strat A or B or maybe adding some logic to determine the current market direction before executing the order, as some bots don't work well with certain market conditions, that way you can keep your bot running and it will only trade if the market is e.g. trending.
please tell me what would you add in the code ??? to implement a stop sending an order ??? Or a slip function ??? if I added an indicator and the overbought or oversold zone did not come and do not want to enter a trade without confirmation of the second indicator
That is a good question. You can add an extra condition before you want to place on order. Let's say you have a crossover and you also want to check another condition, so the logic would look as follows: if bullish_crossover and rsi_oversold: Buy You can create a new indicator column and check other conditions as well which serve as filters for entries.
Hi Xiang Li, it is a habit of mine to run finished code in the command prompt. PyCharm is a heavy IDE and may take up alot of memory. When deploying robots on a VPS, you want to maximize resources. I do run my code in PyCharm for testing purposes but for this video, I decided to present it it cmd window.
great but please teach us how to run our python but on a host or server because it just run on our computer because it need to run metatrader5.exe first in order to trade .thanks
When I try to run the code like you in the command prompt, it does show that the code is analyzing the MT5 data. But no trades are opening on my MT5. What problem might I have? How can I fix it?
Got it! Seemed to work now, what had happened was I needed to change the 'mt5.ORDER_FILLING_IOC' to 'mt5.ORDER_FILLING_FOK'. Would you know how I can write code to input stop loss and take profit for my risk management? Thanks for all the helpful videos
Great video! I have installed pandas & MT5 successfully, however I am getting errors in code (after MT5 is opened with focus on instrument e.g. EURUSD): 'DataFrame' object has no attribute 'close' and another one 'IndexError: single positional indexer is out-of-bounds' .. how can I resolve these.
Hi, most likely, the DataFrame is empty. Please make sure that all symbols in the market watch are enabled. Also, try to enter a shorter time period in MT5. Sometimes, when the period is too long, it won't return any data.
Trading bots are mostly scams... but there are exceptions. You just need a lot a patience to backtest and run many bots, discard the ones that are scams and keep playing with the ones that are good. EDIT: since so many of you ask, yes I use Galileo FX..
Hey. I recently discovered a lot of your videos on Python and trading because I am a student. I really enjoy it when a presentation goes into such detail and explains everything with codes. I also came across another such video by QuantInsti that talks about backtesting a trading strategy - "Full Algo Trading Course | Python Trading Bot | Python Quantitative Trading | 3/3". Quite curious to try both. Thank you!
Thank you again for laying our foundational understanding in these programs. What I wanted to know if you can also sometime show how to trade more than one currency pair and also what about trading the EU and EJ, then the decimals differ. Also as an add-on what is the best way to run these scripts, as I have previous tried and they run for a few hours, but then crash when just starting then straight from CMD. Cheers
Hey, regarding the decimals, you can adjust the point values based on the digit based on each symbol. Each symbol has its own decimal point value which you can get from symbol_info(). Therefore, the point value is easilly calculated using the following formula: point value = contract size / (10^digits) Regarding the script crash, there may be many causes. Do you have the error logged upon crash? If so, you can send me more details to tu@traderpy.com and I will happily have a further look.
Hi, yes of course. All you need to find a broker who offers trading the VIX. IC Markets, the broker I'm affiliated with, offers it. Check the description for more info. :)
I tried this code on JUPYTER NOTEBOOK and i was getting this error of "IndexError: single positional indexer is out-of-bounds" due to the "iloc" builtin function in the SIGNAL function definition whenever i run the code, if anyone can sort it out kindly. Thank you!
From our experience, the requests do not interfere with the broker server and the it shouldn't cause a problem. A sleep function of 1 second is implemented in the code already.
Please help with how to set up the mql5 environment with python i keep getting this error "C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\python.exe" -u "C:\Users\USER\AppData\Roaming\MetaQuotes\Terminal\A5862E2007921267C73493E43631301B\MQL5\Scripts\testing.py" unknown 1 failed in the mt5 journal and also 'Python testing2': python process thread create error [The system cannot find the file specified. (2)]
I really need your help in your code, it runs perfectly, the only parameter missing is stoploss and takeprofit I'm trying to put a stoploos of 20 points and a takeprofit and 1 point, but when I do that it doesn't send the orders to the market
hello sir i am new here i want your help sir please sir kindly write a code on crossing moving averages exponential method where two line cross over take buy or sell
Hi Van De Sar, I am currently studying ML but as of this moment, I don't have enough practice to be confident in presenting this topic. Maybe sometime in the future. I do recommend Ernest Chan who is a great role model in developing ML models for trading: ruclips.net/video/BhaJVZNpL4M/видео.html
last_close = bars_df.iloc[-1].close it gives an "IndexError: single positional indexer is out-of-bounds" in the line above. What should i do? why we index it to [-1]?
Such a great video! It seriously helped me create my very own trading bot. If you're a beginner like me, this video is a must-watch. Also, check out "Algorithmic Trading Tutorial Python | Build Trading Algorithm from Scratch" by QuantInsti - another awesome video that helped me understand the fundamentals of algorithmic trading and build my own algorithm. Super helpful and definitely worth watching! Big thanks to both videos for giving me the knowledge and confidence to create my trading bot. Can't wait to see what it can do! 😄🚀
Your example its amazing! Its better than the all mql5 documentation! I am very glad with you!
Thanks for the code, brother. I really needed a break and this is it. I wish you the best.
What type of content do you want to see next? Do you want to see more code examples on different algo trading strategies? Do you want to see more backtests, strategy analysis or live trading? Or do you prefer to go more in-depth into the actual code? Please let me know and have a great day :).
Hi,thks for your video. It`s very very helpful for me ! I think this is a very good video serial for anyone who wants to learn trading by python.
@@xiangli4314 I so much agree!!
I see where you did a video on the long and short SMA cross over, could you do a short video on how to deploy it live? would love to see that
Can you show the example code of GRID trading with Martingale strategy?
how I can run my python code 24\7 in mt5 ?
Great video mate! Very nice starting point to develop a trading bot using python + MT5.
thank you very much for such an instructive and wonderful lesson, it's just super
Hi there.. do you always run your code directly on demo account, or did you some backtesting before dropping the code on the account.?
If you did backtesting it, how did you do it.?
Excellent video, Thank's sir
Thanks a lot bro.... Thank you so much for this wonderful video
Thek you very much, I follow up on your content and it interested me. For the next content, can you show the example code of GRID trading with Martingale strategy?
I was knocked out by stop loss. But the indicator conditions were satisfied and the robot sent again the order. Again, the stop loss was knocked out so that it did not continue. You need to write a timeout for 1 hour in the code, for example. until the news spike passes
Hi, is there any way to copy iCustom indicator or MQL Indicator buffer values into Python?
great tutorial .though I encountered an error 'IndexError: single positional indexer is out of bounds' which occured between lines 93 and 121.I need your help debugging this please.
I am new to Trading with Python but I wonder is there a more efficient way than to check for a signal with an infinite loop? Because therefore it requests the former close price many times per second but actually it would be enough to get the close price only when a bar is closed (so once a minute in your example).
you could use time.sleep(60) to pause the program between each loop iteration
big content my friend love it
Salute Great content ..
Am trading local Stokes and am trying to figure out if it is possible to create a price alert bot if non of the brokers in my area are featured on mt5.
Thanks in advance
Hey man, this is beautiful. Thanks.
how would you set the timeframe so that it runs through multiple time frames?
Thank you and thank you again great content
did it try it with any exchanges in Cryptocurrency or you could try to optimize it with Binance exchange.
Maybe I missed it, but where do you have a TP?
for me this doesnt work because you are setting the last close bar > sma to signal buy and vice versa. it doesnt mean buy when the price is above the moving average and sell when it is below the sma. when i run this code it sells when the last close bar of a timeframe specified if it is below the sma then sell and above then buy. when i look on your screen it seems your code runs differently for some reason.
If I want to change my instrument what adjustment should I do?
Can I use it in Indian stock market
can you use this python script to backtest in MT5 terminal...If yes please make a video on that I couldn't find a single video on this topic.
how did you get the command prompt on mac?
TraderPy ---many thanks
Hi, it was a great presentation and good to see the nice code.
Would you be able to share code or checked in some where please?
how to applied this in nasdaq, bei, or stock market?
Thank you very much for sharing, But How can I stop the prompt to display any text, just run the algo without any output in the commandline?
Is it possible to get the stategy parameters from an INI file ?
hi i coding that like but with supertrend . Can you share about like video? Thank you
Hi i have created sma cross over strategy on 5 min timeframe and i am getting tick by tick data but i need some help to updat code of one logic can ypu help me the same . I am happy to share the code
It return me an error inside the function definition "signal()", it say to me "index out of bound", is it correct to change iloc[-1] with iloc[0] to target the first element?
Do you have any Github repos with this code?
This phyton tools will work in tester?
Unfortunately, it will not but we have our own backtester to evaluate the results.
The code link for this video does not work.
How to loop through all the symbols using this code ?😊
Love your videos! to the point, have you ever done a bot that can choose a strategy based on a market condition, e.g. trending or ranging market then choose strat A or B or maybe adding some logic to determine the current market direction before executing the order, as some bots don't work well with certain market conditions, that way you can keep your bot running and it will only trade if the market is e.g. trending.
Awesome
you are good bro thank you again and again.
please tell me what would you add in the code ??? to implement a stop sending an order ??? Or a slip function ??? if I added an indicator and the overbought or oversold zone did not come and do not want to enter a trade without confirmation of the second indicator
That is a good question. You can add an extra condition before you want to place on order.
Let's say you have a crossover and you also want to check another condition, so the logic would look as follows:
if bullish_crossover and rsi_oversold:
Buy
You can create a new indicator column and check other conditions as well which serve as filters for entries.
The discord link doesn't work
Can you elaborate a bit more on how order type is determined thru dictionary. The order type should written in full, for ex: mt5.ORDER_TYPE_BUY
@TraderPy
HI, where is set up the connection to the metatrader account? only if I run the python script in windows cmd, it will be worked? Thanks
Did you find the answer yet i have the same question
Hi, I don't understand why u don't active this robot directly with ur code editor?(like: pycharm)
Hi Xiang Li, it is a habit of mine to run finished code in the command prompt. PyCharm is a heavy IDE and may take up alot of memory. When deploying robots on a VPS, you want to maximize resources.
I do run my code in PyCharm for testing purposes but for this video, I decided to present it it cmd window.
great but please teach us how to run our python but on a host or server because it just run on our computer because it need to run metatrader5.exe first in order to trade .thanks
When I try to run the code like you in the command prompt, it does show that the code is analyzing the MT5 data. But no trades are opening on my MT5. What problem might I have? How can I fix it?
Hi, do you receive any message back when you send an order? Please make sure that Auto Trading is enabled in the MetaTrader5 platform.
Got it! Seemed to work now, what had happened was I needed to change the 'mt5.ORDER_FILLING_IOC' to 'mt5.ORDER_FILLING_FOK'. Would you know how I can write code to input stop loss and take profit for my risk management? Thanks for all the helpful videos
Great video! I have installed pandas & MT5 successfully, however I am getting errors in code (after MT5 is opened with focus on instrument e.g. EURUSD): 'DataFrame' object has no attribute 'close' and another one 'IndexError: single positional indexer is out-of-bounds' .. how can I resolve these.
Hi, most likely, the DataFrame is empty. Please make sure that all symbols in the market watch are enabled.
Also, try to enter a shorter time period in MT5. Sometimes, when the period is too long, it won't return any data.
Great content, would recomend you to add the overlap of a 10 and 15 EMAs as a signal in your enviroment.
Trading bots are mostly scams... but there are exceptions. You just need a lot a patience to backtest and run many bots, discard the ones that are scams and keep playing with the ones that are good. EDIT: since so many of you ask, yes I use Galileo FX..
@@RobinArgumido 😁
I have also built a trading bot...but I am having some issues...so i need your help.
Hey. I recently discovered a lot of your videos on Python and trading because I am a student. I really enjoy it when a presentation goes into such detail and explains everything with codes. I also came across another such video by QuantInsti that talks about backtesting a trading strategy - "Full Algo Trading Course | Python Trading Bot | Python Quantitative Trading | 3/3".
Quite curious to try both. Thank you!
Can you please share on how to convert SMA to EMA.
the source code link doesnt work , what can I do to open it on an IDE?
Thank you again for laying our foundational understanding in these programs. What I wanted to know if you can also sometime show how to trade more than one currency pair and also what about trading the EU and EJ, then the decimals differ. Also as an add-on what is the best way to run these scripts, as I have previous tried and they run for a few hours, but then crash when just starting then straight from CMD. Cheers
Hey, regarding the decimals, you can adjust the point values based on the digit based on each symbol.
Each symbol has its own decimal point value which you can get from symbol_info(). Therefore, the point value is easilly calculated using the following formula:
point value = contract size / (10^digits)
Regarding the script crash, there may be many causes. Do you have the error logged upon crash? If so, you can send me more details to tu@traderpy.com and I will happily have a further look.
Hello Sir. its an amazing script. i would like to make it take profit once the trade runs in profit in seconds. how can i do that?
You are great Man! Just wanna say that. Thank you for all!
Thank you!
Can i use this script for volitality index?
Hi, yes of course. All you need to find a broker who offers trading the VIX. IC Markets, the broker I'm affiliated with, offers it. Check the description for more info. :)
What's your coding environment like? Can you deploy on linux?
I use windows VPS where I deploy using Remote Desktop Connection.
Hello. Can you create multihedge strategy with python?
Hi, do you have any link where I can read more details about this strategy?
I can't install MT5 lib on mac
Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)
bruh it's only available for windows, try virtual machine
I love you man
IndexError: single positional indexer is out-of-bounds
I gee this error when I try to run the code
Please help
I tried this code on JUPYTER NOTEBOOK and i was getting this error of "IndexError: single positional indexer is out-of-bounds" due to the "iloc" builtin function in the SIGNAL function definition whenever i run the code, if anyone can sort it out kindly. Thank you!
Maybe it’s worth adding a command (Sleep) so that the broker doesn’t ban you for the number of requests to the exchange???
From our experience, the requests do not interfere with the broker server and the it shouldn't cause a problem. A sleep function of 1 second is implemented in the code already.
Please help with how to set up the mql5 environment with python i keep getting this error
"C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\python.exe" -u "C:\Users\USER\AppData\Roaming\MetaQuotes\Terminal\A5862E2007921267C73493E43631301B\MQL5\Scripts\testing.py" unknown 1 failed
in the mt5 journal and also
'Python testing2': python process thread create error [The system cannot find the file specified. (2)]
Bro code price action strategy algo
I really need your help in your code, it runs perfectly, the only parameter missing is stoploss and takeprofit
I'm trying to put a stoploos of 20 points and a takeprofit and 1 point, but when I do that it doesn't send the orders to the market
Hi, try to use floats instead of integers. Also sl and tp params are set as exact price levels.
@@ATJTraders618 Ok, I contacted your email explaining better, thanks for the help
Anyone know where I can get the code from in this video?
Hi, the description has been updated with the download link.
Hello, Nice Video
Please i have a trading strategy that i want to turn into a trading bot
Can I run it using VS CODE?
Yes, of course. :)
Can you run the code on mt4?
Did you find an answer?
hello sir i am new here i want your help sir please sir kindly write a code on crossing moving averages exponential method where two line cross over take buy or sell
Please create a video of trading robot using Machine Learning or Some Ai Tools inside the Python . Thanks
Hi Van De Sar, I am currently studying ML but as of this moment, I don't have enough practice to be confident in presenting this topic. Maybe sometime in the future.
I do recommend Ernest Chan who is a great role model in developing ML models for trading: ruclips.net/video/BhaJVZNpL4M/видео.html
@@ATJTraders618 Don't worry, I just made a suggestion for your future plans. The videos you currently make are great.
Can anyone plz suggest me the documentation
Hi, you can find the documentation for MT5 and the source code in the descriptions.
MetaTrader 5 library no longer working in python.
i have error 'unsupported filling mode'
Hi, it means that your broker only accepts certain order types.
You can specify it filling type parameter and try different values like:
FOK
GTC
IOC
could u share the code scripts as text so I can copy to run on my server?
oh i found it thank u
good day bro, if you can read my comment, I came across this tutorial and it is very useful but it seems it does not work anymore.
Source code?
last_close = bars_df.iloc[-1].close
it gives an "IndexError: single positional indexer is out-of-bounds" in the line above. What should i do? why we index it to [-1]?
@John Salvadore teşekkürler✌🏻
Statistical Arbitrage!!!👋👋👋👋👋
Hola
Such a great video! It seriously helped me create my very own trading bot. If you're a beginner like me, this video is a must-watch.
Also, check out "Algorithmic Trading Tutorial Python | Build Trading Algorithm from Scratch" by QuantInsti - another awesome video that helped me understand the fundamentals of algorithmic trading and build my own algorithm. Super helpful and definitely worth watching!
Big thanks to both videos for giving me the knowledge and confidence to create my trading bot. Can't wait to see what it can do! 😄🚀