Codes

Open Trade for MetaTrader 5

This function performs the main logic of opening a trade. Calculates the opening price, take profit levels and stop loss based on symbol information and parameters provided by the user. Prepare a trade request (MqlTradeRequest) with the necessary information, such as symbol, volume, order type

Input and output of onnx model for MetaTrader 5

The script is useful for inspecting the structure of ONNX models, providing insights into the input and output, their names, and their properties. It is particularly helpful for debugging and understanding the characteristics of ONNX models used in machine learning applications

Symbol Filling Policy Determination for MetaTrader 5

This function allows you to retrieve and return the filling policy of a symbol in MetaTrader 5. This is useful for making trading decisions based on the filling policy of a specific financial instrument

Current Relative Drawdown for MetaTrader 5

The DD_Relative function calculates the drawdown (relative loss) of the current trading account in percentage. To do this, it uses the Current_LossOrProfit() function to get the current profit or loss for all open positions and divides it by the current account balance. The result is rounded to two

Check the time periods used for MetaTrader 5

The function takes two arrays of integers as parameters: "allowedPeriods" and "periodsToCheck". "allowedPeriods" is an array containing all the time periods allowed by the system, while "periodsToCheck" is an array containing the time periods used by the user in the indicator. The function iterates

Forum

Handle Broker Diff?

A strategy can work specifically for one broker but it cannot work for another broker , knowing that in the end the prices are always the same everywhere with the only difference that the brokers make manipulations to the formation of candles (OHLC ) of prices as well as manipulating the bid /ask or

C# and Metatrader 5 integration.

Hello, good day, I would like to know if there is any other way to connect Metatrader 5 with C# without using .dll, or shared files(but this is too slow) or TCP/IP connection. I have read that there is documentation for integration with Python, but I have not found information for integration with

Deleting autotrade Object.

Hello, good day programmers, I have tried to eliminate the arrows and trendlines from the autotrades but they are only removed from the current chart but not from the other charts opened by the strategy tester. and in the same way when I call the function in the OnDeinit() part they are not

Minimum/Maximun levels.

Hello, good day, fellow programmers. I wanted to ask if there is a better way to get the minimum/maximun values. I use this function to add and/or subtract to open a position, either buy or sell. but I get different results when changing the values, for example from 1 to another value, for example

Weird Message

Good Day programmers, at the end of a backtesting I get this strange error, any idea what it could be? I have searched in different pages/forums about the message but without success. Also mention that nowhere in my code do I have a print, comment, etc. about it. This is the message: 2023.03.14

Excluding PERIOD_M12 from mq5 Testing.

Hello fellow programmers, first of all thanks for reading. I have a dilemma, the thing is that I use the "Only Open Prices" modeling in the strategy tester and in the optimizer for more speed. The issue is that since I can only use temporalities that are non-multiple timeframes as it says in this

RAM and Expert Advisor Problem.

Good Day, fellow programmers, I have a problem. I have a multi-symbol Expert Advisor (in which only the symbols are added and it automatically uses them without opening the charts) without compilation errors and without creating any objects on the different charts. The problem happens when I put it

Limited strategy tester.

Good day. traders, I am telling you because I have encountered a difficulty when it comes to backtesting and/or optimization. Maybe it could be due to the limitation of MQ5 if that was the case. Here below you have a backtesting of a bot that I did multicurrency with data from IC-Markets. in which