You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Forum on trading, automated trading systems and testing trading strategies
Python in algorithmic trading
MetaQuotes, 2023.04.18 11:40
1. MetaTrader 5 Python Library and Connecting Python with MetaTrader 5
1. MetaTrader 5 Python Library and Connecting Python with MetaTrader
The video showcases step-by-step instructions for installing the MetaTrader 5 Python library and setting up a connection between MetaTrader 5 and Python using account details. The presenter explains the process in detail, including how to search and install the Metatrader5 package, how to import the library, and how to establish a successful connection with a trading account. Overall, the video serves as a useful guide for those looking to integrate MetaTrader 5 with Python.
Forum on trading, automated trading systems and testing trading strategies
Python in algorithmic trading
MetaQuotes, 2023.04.18 11:40
2 Placing Buy Limit and Sell Limit Orders with Python
2 Placing Buy Limit and Sell Limit Orders with Python
This video demonstrates the process of placing buy and sell limit orders using Python's `empty_file.order_send()` function and key-value pairs. The user can provide the currency symbol, volume, and order type as inputs to the function to place a buy limit order. The video also shows how to create custom functions for placing limit orders and capture output using variables. The same process applies to sell limit orders, with the type and price specified differently.
Forum on trading, automated trading systems and testing trading strategies
Python in algorithmic trading
MetaQuotes, 2023.04.18 11:47
Code Your Own Trading Bot with ChatGPT and Python
Code Your Own Trading Bot with ChatGPT and Python #chatgpt #trading
In this video, I'll show you the easiest and fastest way to build a ChatGPT trading bot for MetaTrader 5 using module for Python and ChatGPT
For this example, we're using only 1 indicator in the video, but you can create your own custom logic using multiple indicators or even implement machine learning!
ChatGPT prompt that is used: " Write me a MetaTrader 5 Module for Python code that connects using acc, password, and server to MetaTrader 5 terminal, implement a function to calculate RSI manually without using TALIB, it should calculate it based on the last 100 candles for the symbol EURUSD in the 1-minute timeframe, and implement buy and sell orders based on the signals of the RSI indicator. On top of the code, declare variables so you're not repeatedly declaring them in functions or the rest of the code, like account, password, server, symbol, timeframe, number of candles, stop loss pips, take profit pips, and so on. To calculate RSI, we first need to calculate the exponential weighted average gain and loss during the period then we use the same formula to calculate Exponential Moving Average. the Relative Strength is the ratio between the exponential avg gain divided by the exponential avg loss. the RSI is calculated based on the Relative Strength using the following formula. calculating the range of each candle then calculating the average value of the ranges RSI is the average value of the ranges. "
Forum on trading, automated trading systems and testing trading strategies
Python in algorithmic trading
MetaQuotes, 2023.04.18 12:35
How to import stock price data from MetaTrader 5 into Python?
How to import stock price data from MetaTrader 5 into Python?
In this YouTube video, different methods to import stock price data from MetaTrader 5 into Python are explained. The methods include importing necessary libraries, setting the desired time frame and time zone, defining a function called "get data," manipulating the resulting data frame, using the tqtndm package, creating a rates frame, and utilizing two data frames to retrieve prices and date/time information. The speaker suggests putting the loops into a function to make the code cleaner, and using these methods, users can easily import data for numerous symbols without much difficulty.
|
Hello sir, thank you so much for the amazing content you have shared with us. Yesterday I was watching a video with name "How to really use overbought and oversold indicators". I don't see that video today. could you please help me find that video.
Thank You
Hello sir, thank you so much for the amazing content you have shared with us. Yesterday I was watching a video with name "How to really use overbought and oversold indicators". I don't see that video today. could you please help me find that video.
Thank You
How To REALLY Use Overbought And Oversold Indicators
This is the small educational video about how to use standard indicators for overbought/oversold levels trading.
--------------
On Methods to Detect Overbought/Oversold Zones - the article
over bougt/over sold levels - educational forum threadForum on trading, automated trading systems and testing trading strategies
over bougt/over sold levels
Sergey Golubev, 2017.08.25 11:03
The forum threads/posts about it
Forum on trading, automated trading systems and testing trading strategies
over bougt/over sold levels
Sergey Golubev, 2017.08.25 10:37
There are many indicators providing overbought/oversold levels, and you can select them in CodeBase.
============
You can look at the following indicators for example:
============
Example to use those levels: +135 pips
============
Forum on trading, automated trading systems and testing trading strategies
Quantitative trading
MetaQuotes, 2023.05.12 12:25
Interview With A Legend In Algorithmic Trading Dr. Ernie Chan
Interview With A Legend In Algorithmic Trading Dr. Ernie Chan
Dr. Ernie Chan, an expert in algorithmic trading, emphasizes the importance of simplicity, risk management, and human judgment in successful trading strategies. He highlights the value of personal experience and expertise in crafting effective strategies and advises traders to remain humble, stay focused, and guard against overconfidence and data snooping bias. Furthermore, Dr. Chan recommends balancing mean reversion and momentum strategies in a portfolio and developing multiple algorithmic systems that are not correlated with each other to ensure a stable return for clients. Finally, he stresses the importance of statistical robustness tests and historical data analysis in determining a strategy's effectiveness and adapting it for new market phenomena.
Dr. Ernie Chan, a legend in algorithmic trading, shares how his portfolio of strategies has evolved by allocating to successful traders and focusing on machine learning-based risk management. He believes that there is no unique indicator that captures all aspects of market reality and that multiple indicators can be used to observe the same reality, which should be screened properly by the machine learning approach. He also talks about his project PredictNow.ai, which offers a probability of loss for every future period using machine learning. Dr. Chan emphasizes the importance of having passion in algorithmic trading and reminds traders to keep their strategies simple, practice on simulators, and check risk levels before investing real money.
Forum on trading, automated trading systems and testing trading strategies
Machine Learning and Neural Networks
MetaQuotes, 2023.05.11 19:58
Should We Be Fearful of Artificial Intelligence? w/ Emad Mostaque, Alexandr Wang, and Andrew Ng | 39
Should We Be Fearful of Artificial Intelligence? w/ Emad Mostaque, Alexandr Wang, and Andrew Ng | 39
The guests in this YouTube video discuss various aspects of artificial intelligence (AI), including its potential dangers, disruption in various industries, and the importance of re-skilling workers to stay relevant. The panelists also debate the usability of AI tools, the implementation of AI in healthcare, standardization in information distribution systems, the potential for wealth creation in AI, and the use of language models in healthcare and education. Additionally, they stressed the need for responsible deployment of AI models, transparency, and ethical considerations in governance. Lastly, the panelists briefly answer some audience questions on topics such as privacy in AI for healthcare and education.
Forum on trading, automated trading systems and testing trading strategies
Python in algorithmic trading
MetaQuotes, 2023.05.16 17:36
Algorithmic Trading Python 2023 - FULL TUTORIAL Beginner
Algorithmic Trading Python 2023 - FULL TUTORIAL Beginner
In this video tutorial, the author delves into the process of installing and utilizing a Python program for algorithmic trading. They provide step-by-step instructions on creating a basic Python 3 file specifically designed for housing code related to algorithmic trading strategies. Moreover, they demonstrate how to execute the code and print the resulting outputs for analysis. The tutorial primarily focuses on harnessing the power of the Python programming language for algorithmic trading purposes. It covers a range of essential functions and libraries applicable to algorithmic trading, including the yfinance library. The tutorial highlights the significance of using these functions and libraries while also exploring data download and processing techniques using spreadsheets.
Additionally, the video tutorial showcases the process of writing and reading CSV files using Python. It explains the necessary steps for creating a CSV file and demonstrates how to read and manipulate the file within a Python environment. Continuing with the theme of Python-based stock trading, the tutorial elucidates the creation of a stock index and demonstrates how the Python function "convert" can be used to modify the index format. Furthermore, it explains how the Python function "start.columns" facilitates changes to the column list specifically for stocks.
The next video tutorial also revolves around using Python for stock trading. It commences by illustrating the download and parsing of stock data, followed by employing the "describe" function to analyze the acquired data effectively. Lastly, it demonstrates the utilization of the "dot lock" function to monitor and track stock prices. Moving on, the subsequent video tutorial provides a comprehensive explanation of using Python to create algorithms for stock trading. It begins by visualizing different starting points for three distinct stocks, subsequently illustrating the normalization of values to represent them within a uniform 100-point range. The tutorial then guides viewers on plotting the normalized closing prices of a stock and utilizing the "dot" (mole) function to multiply the values by 100, enhancing readability.
Similarly, another video tutorial focuses on utilizing Python to create stock trading algorithms. The tutorial outlines the process of creating a new column within a dataset to store information regarding closed stocks. It further explains the utilization of the "shift" function to relocate data to the bottom of the column. Additionally, it showcases the calculation of percentage changes in stock prices from the previous day. Shifting gears, another tutorial introduces learners to utilizing Python for statistical calculations related to algorithmic trading. It provides guidance on employing functions such as "shift," "subtract," and "divide" to compute lag and diff-related data.
Next, the video delves into calculating percentage changes for financial assets using Python. It demonstrates modifying the "change" function to improve readability by renaming it as "pst." Furthermore, it sets the "periods" variable to one and multiplies the percentage change by 100 to represent it in point value format. The video also covers calculating the standard change for an asset, subtracting it from the percentage change to eliminate the impact of the first day. The dataframe for a specific asset is renamed as "change," and the "change" column is created. The tutorial concludes with running a check on the "change" column using "aafl" and saving the dataframe.
Moreover, the tutorial author explains how to calculate mean, standard deviation, percentage change, and returns for a given dataset. They also demonstrate plotting a histogram and creating a hit system graph.
Continuing with statistical calculations, another video tutorial explains calculating the mean, variance, and standard deviation of a stock's returns. Additionally, it provides guidance on determining the annual mean return and the annual variance return.
Expanding further, the tutorial showcases calculating the annual standard deviation of a stock's returns using the "std" function in Python. This approach efficiently analyzes large datasets by taking data from a ticker symbol instead of individual data points. The tutorial also demonstrates creating columns to track the mean and standard deviation of a stock's return, as well as the mean and standard deviation of a stock's percentage change. It further explains calculating the mean and standard deviation of a stock's return using the "summary" function.
The author also covers the creation of scatter plots and annotating them to illustrate the return and risk associated with different stocks. This visualization helps in understanding the relationship between returns and risks in the context of stock trading. Moving on, the video tutorial delves into using Python to create algorithms for trading stocks. It explores the usage of for loops and functions such as covariance and correlation. Additionally, it showcases the graphical representation of the algorithm's results, enabling traders to visualize and analyze the performance of their trading strategies effectively.
Furthermore, the tutorial explains how to leverage the seaborn library to create a heatmap depicting stock correlations. It provides a step-by-step guide along with a code download for the entire project, facilitating the implementation of stock correlation analysis using Python. Shifting focus, the presenter in a video tutorial educates viewers on calculating the risk and reward potential of a portfolio of stocks using Python. They discuss the limitations of simple returns and introduce the concept of log returns, demonstrating their practical application in assessing risk and reward. This analysis helps traders make informed decisions regarding their portfolio composition and risk management.
Another tutorial elucidates the process of calculating a simple moving average using the "rolling" function in Python. By applying this technique, traders can smoothen the fluctuations in stock prices and identify trends more effectively. In addition, a tutorial demonstrates the calculation of the mean, median, and moving average of a dataset, emphasizing their significance in analyzing and understanding data patterns.
Moreover, a video tutorial showcases the calculation of various moving averages, including the 50-day moving average, 200-day moving average, and EMA (earnings-to-price) of a stock. These moving averages are then plotted on a graph, aiding traders in identifying key trends and potential trading signals. Continuing with data manipulation techniques, a video tutorial explains the utilization of the re-index function in pandas to replace missing values within a dataframe. It also covers the application of forward and backward fill functions to manage data when encountering holidays and weekends.
The video tutorial further demonstrates the calculation of returns for a stock over time, encompassing buy and hold returns, cumulative returns, and maximum returns. Additionally, it explores the computation of cumulative maximum returns and visualizes the data through graph plotting. Furthermore, the tutorial explains how to calculate drawdowns for a stock, as well as the maximum cumulative return and maximum cumulative drawdown. Understanding drawdowns helps traders assess the risk associated with investments and identify potential loss scenarios. In a similar vein, another video tutorial discusses calculating drawdown and maximum drawdown for a stock. Additionally, it provides an overview of calculating percent drawdown, a crucial metric in risk management.
A Python 2023 tutorial on YouTube introduces viewers to creating a moving average crossover strategy for trading. This strategy involves utilizing two moving averages, a 50-day moving average, and a 100-day moving average, to determine the stock's trend and generate trading signals accordingly. Moreover, a video tutorial explains how to write Python code for trading stocks. It demonstrates the process of determining whether to buy or sell a stock based on its current price and past price data. It also covers using a library to track a stock's position over time, allowing traders to monitor and manage their portfolio effectively.
The tutorial video enlightens viewers on backtesting an algorithmic trading strategy using returns and standard deviation. It showcases a strategy that outperforms a 50-day moving average in terms of returns but comes with higher standard deviation, highlighting the trade-off between risk and reward. Additionally, the video tutorial guides users through creating an investment strategy and comparing it to other strategies. It emphasizes that the strategy with the best returns is the one with a long bias, indicating a preference for bullish positions.
Furthermore, the author introduces a function to create a test strategy for algorithmic trading. This function takes parameters such as stock name, start and end dates, and returns key performance metrics such as daily return, cumulative return, and SMA (Simple Moving Average). By utilizing this function, traders can assess the effectiveness of their trading strategies and make data-driven decisions. The tutorial then proceeds to demonstrate how to build an algorithmic trading Python script. The script incorporates a simple stop-loss and take-profit strategy, aiming to achieve better overall performance compared to a traditional buy-and-hold investment approach. This script serves as a foundation for developing more sophisticated trading algorithms.
The presenter also showcases the process of backtesting a trading strategy written in Python. The strategy, created by the presenter, is tested on historical stock market data from 2017, enabling traders to evaluate its performance and viability. Moreover, the tutorial explains how to code a Python2023 algorithm for trading stocks and cryptocurrencies. It covers the utilization of APIs to access data from various stock and cryptocurrency exchanges, enabling traders to analyze real-time market data and implement trading strategies accordingly. The video tutorial further explores using Python to trade stocks and cryptocurrencies. It encompasses data entry, analysis, storage, manipulation, and the execution of trade strategies using API services. By leveraging these techniques, traders can automate their trading processes and efficiently manage their portfolios.
Additionally, the tutorial provides comprehensive guidance on using Python to trade stocks and other financial assets. It covers fundamental concepts such as price analysis and trading, as well as advanced topics like backtesting and utilizing APIs for data integration. This tutorial equips traders with the necessary knowledge and tools to engage in algorithmic trading effectively.
In conclusion, these tutorials and videos offer a wealth of information on using Python for algorithmic trading. They cover a wide range of topics, including data processing, statistical analysis, visualization, strategy development, backtesting, and real-time trading. By following these tutorials, traders can enhance their understanding of algorithmic trading principles and leverage Python's capabilities to make informed trading decisions.
dot (mole) function to multiply the values by 100 to make them easier to read.
Forum on trading, automated trading systems and testing trading strategies
Programming tutorials
MetaQuotes, 2023.05.24 16:53
Code complete EA for MetaTrader 5 in 20 Minutes!
Code complete EA for MetaTrader 5 in 20 Minutes!
Today, we are excited to start recording our first EA (Expert Advisor) for the MetaTrader trading platform. This EA is designed to be a trading system for MetaTrader, and in our video, we will also perform a quick backtest to evaluate its performance.
To begin, we launch the MetaTrader platform and access the MetaEditor by clicking on "Tools" and selecting "MetaQuotes Language Editor" from the dropdown menu. The MetaEditor is where we create our expert advisors, as well as scripts and indicators for MetaTrader.
To create a new expert advisor, we click on the "New" button in the top left corner of the MetaEditor. In the wizard that appears, we select the first option and click "Next." We can then give our EA a name, such as "First EA," and click "Next" again. We skip selecting any additional options and proceed by clicking "Finish."
Now we have the initial code for our EA. To start, we clean up the code by removing unnecessary comments, such as the gray comments that provide no functionality to the code itself. We delete the first five lines and some other unnecessary lines, as per our preference.
Before we begin coding, let's take a moment to consider what we want our EA to do. For this video, our goal is to have the EA open a buy trade at a specific time and close it at another predetermined hour of the day. To achieve this, we need two input variables: one for the open time and another for the close time.
Returning to the MetaEditor, we declare these two input variables under a new section called "Variables." We use the "input" keyword to specify that these variables can be changed from outside the code. We set their types as integers since we want to enter specific hour values. For example, we can name the variables "openHour" and "closeHour."
After declaring the variables, we compile the code to ensure there are no errors. If everything is correct, we can see that there are no error messages in the toolbox.
Next, we switch back to the MetaTrader platform and drag our EA onto any chart. We can see the EA's name, version, and link in the navigator under "Expert Advisors." By expanding the EA, we can access the input variables and change their values without modifying the code.
Now, let's move on to the "OnTick" function, which is called every time the price changes. We want to check if we have reached the open time specified by the user. To do this, we need to retrieve the current time of the symbol and the server. We create a variable called "time" of type "datetime" and use the "TimeCurrent" function to assign the current time to it.
With the current time stored in our "time" variable, we can now check if it matches the open time. We use an "if" statement to compare the "openHour" variable with the hour component of the current time ("time.hour"). If the condition is true, we enter the "if" block.
Inside the "if" block, we open a position using the "OrderSend" function. We specify the symbol, trade direction (buy), lot size (1 lot), and ask price as parameters. Additionally, we set the stop loss and take profit values as per our preferences.
After compiling the code and running a backtest using the MetaTrader strategy tester, we observe that the EA opens a position at the specified open time. However, we notice that multiple positions are opened due to subsequent price movements triggering the "OnTick" function again.
To prevent multiple positions from being opened, we introduce a boolean variable called "isTradeOpen" to keep track of whether a trade is already open. Initially, we set the value of "isTradeOpen" to false. Before opening a new position, we check if "isTradeOpen" is false. If it is, we proceed to open the position and set the value of "isTradeOpen" to true. This way, even if the "OnTick" function is triggered multiple times, it will only open a new position if there isn't already an open trade.
After implementing this logic, we compile the code again and run a backtest. This time, we observe that the EA opens a position at the specified open time and does not open any additional positions until the previous one is closed.
Moving on to closing the trade at the specified close time, we need to introduce another check in the "OnTick" function. After opening the position, we compare the current time with the close time specified by the user. If they match, we enter an "if" block.
Inside the "if" block, we close the trade using the "OrderClose" function. We provide the ticket number of the position to close, as well as the lot size and bid price as parameters. Additionally, we can set additional parameters such as stop loss and take profit values if desired.
We compile the code again and run a backtest to verify that the trade is closed at the specified close time. During the backtest, we can check the trade history to ensure that the positions are opened and closed according to the specified times.
We have successfully created our first EA for the MetaTrader trading platform. The EA is designed to open a buy trade at a specific open time and close it at a predetermined close time. We have implemented input variables to allow customization of the open and close times without modifying the code. By introducing checks and variables, we ensure that only one trade is opened at a time and that it is closed at the specified close time.